If $f$ is a differentiable function on $\mathbb{R}$ such that $f'(x)\ne0$ for all $x\in\mathbb{R}$, show that $f$ is monotone. You are not allowed to assume that $f'$ is continuous.

By the mean value theorem we have that $f(b)-f(a)=f'(c)(b-a)$ for a closed interval [a,b]. Also from Darboux's theorem, we have that there exists a number $k$ such that if $k$ is between $f'(a)$ and $f'(b)$, then there is at least one point c in $(a,b)$ such that $f'(c)=k$.

We have that $f'(c)\ne0$, so by the mean value theorem, $f(b)\ne f(a)$. If $f(b)>f(a)$ then there is a number $k$ such that $f(b)>f(c)=k>f(a)$ then since $f'(x)\ne 0$ for all $x$, $f$ can never retake the value of $k$.

Am I on the right track? I'm not sure how to continue.