Assume that $b-a\lt\pi$ and consider $$c=\tfrac12(\pi-b-a),\qquad s=\sin(a+c).$$ Then $s=\sin(b+c)$ (always true), $s\gt0$ (because $0\lt b-a\lt\pi$), and $\sin(x+c)\gt0$ for every $x$ in $(a,b)$.
Furthermore, $f(a)=f(b)=0$ and $f\gt0$ on $(a,b)$, hence $f'(a)\geqslant0$ and $f'(b)\leqslant0$, which implies that $f'(b)-f'(a)\leqslant0$.
All this being kept in store, let us consider the integral $$\int_a^b(f''(x)+f(x))\sin(x+c)\mathrm dx=\left.f'(x)\sin(x+c)-f(x)\cos(c+x)\right|_a^b=(f'(b)-f'(a))\,s.
The LHS is nonnegative as the integral of a nonnegative function and the RHS is nonpositive as the product of $f'(b)-f'(a)\leqslant0$ by $s\gt0$, hence the LHS is actually zero.
It follows that the function in the integral must be identically zero, that is, $f''+f=0$ on $(a,b)$. The rest is direct.