For typographical reasons, I'm going to switch to Newton-style $\dot f$ notation for derivatives.
It is natural to consider the function $F=f^2+\dot f^2$ and its derivative $\dot F = 2\dot f (f+\ddot f)$. At any point of extremum of $F$ we have either
- $\dot f=0$ — hence $F=f^2\le a$, or
- $f+\ddot f=0$ — hence $F= \ddot f^2+\dot f^2 \le b$
Unfortunately this isn't enough, because it is conceivable that $F$ could grow at infinity without having any points of extremum. We have to work harder.
Suppose the conclusion is false. Then there is $\epsilon>0$ such that the set
$$U=\{f^2+\dot f^2> \max(a,b)+\epsilon\}$$ is nonempty. Being open, $U$ can be written as the disjoint union of open intervals. Let $I$ be such an interval. At every point of $I$ we have $\dot f^2>\epsilon$. By the mean value theorem,
$$|f(u)-f(v)|\ge \sqrt{\epsilon}\,|u-v|,\qquad \forall u,v\in I$$
Since $f$ is bounded, it follows that $I$ is a finite interval. By its construction, $F=\max(a,b)+\epsilon$ at the endpoints of $I$. Therefore, $F$ attains a maximum inside of $I$, to which the reasoning from the beginning of the post applies.