I don't understand this particular segment within the proof: Let $c_0\in(a,b)$ and $f(c_0)>0$. Let $c$ be a global maximum, since $f(c)>f(c_0)$ then $c$ is in $(a,b).$
How does $f(c)>f(c_0)$ imply $c$ is in $(a,b).$ Surely, as a global max $f(c)$ is greater than all other $f(x)$, regardless of whether they are in $(a,b)$ or not.
I think more context is needed. I suspect the proof meant to say global maximum over the region $[a,b]$, that is $c \in [a,b]$.
Since $f(c) > f(c_0)>0=f(a)=f(b)$.
$c$ cannot be equal to $a$ or $b$. Hence $c \in (a,b)$.
You are right that if the global maximum can refer to arbitrary function being optimized beyond the region $[a,b]$, the statement need not be true.