As $f$ is continuous on $\mathbb{R}$, it is so on $[0,1]$. Let $\alpha=\sup_{x\in [0,1]} f(x)$ and $\beta=\inf_{x\in [0,1]} f(x)$, then by continuity there exists some $x_0,x_1$ such that $f(x_0)=\beta$, $f(x_1)=\alpha$. If any of $x_0$ or $x_1$ lies inside $[0,1]$ (i.e. not an endpoint) then $f'$ vanish at that point, since we'd have local maxima/infima.
So assume that $x_0,x_1$ are endpoints, and WLOG we may assume that $x_1=1$ (otherwise consider $f(-x)$ instead). Further, we may assume $f'$ does not vanish at endpoints.
If $\alpha=\beta$ then $f$ is constant on $[0,1]$ so we are done. Assume $\alpha>\beta$.
Now assume for a contradiction that $f$ is injective. It follows that $f(\mathbb{R}\setminus [0,1])\subseteq \mathbb{R}\setminus [\beta,\alpha]$. By intermediate value theore, (or by continuity + connectedness, whichever way you'd like) it then follows that $f(1,\infty)$ and $f(-\infty,0)$ are connected, ie intervals. Therefore, either $f(1,\infty)\subset (\alpha,\infty)$ or $f(1,\infty)\subset(-\infty,\beta)$. But second case cannot be possible, since $\lim_{x\to 1+}f(x)=\alpha$ by continuity, which cannot happen if $f(1,\infty)\subset(-\infty,\beta)$.
Simiarly, we have $f(-\infty,0)\subset (-\infty,\beta)$. But then for large enough $x$ (>1) we have that $f(x)-f(-x)>\alpha-\beta>0$, contradictory to assumption. So $f$ is non-injective, and there exist $x_1,x_2$ distinct and $f(x_1)=f(x_2)$. Now conclude by Rolle's theorem.