Suppose to the contrary that a continuous function $f$ does attain every value exactly twice.
The function $f$ has exactly two zeros. Say they are located at $a$ and $b$, with $a < b$.
Since $f$ is continuous on $[a,b]$ and not identically zero it must attain a nonzero value. Assume without loss of generality that $f$ attains a positive value on $[a,b]$. Then $f$ must attain a maximum positive value on $[a,b]$ at some point $c \in (a,b)$.
Since $f$ attains every real value exactly twice there is a point $d \in \mathbb R$ with $f(d) = 2 f(c)$. By the way $c$ was selected we must have $d \notin [a,b]$.
The points $a,b,c,d$ are arranged in one of the orders $$d < a < c < b \quad \text{or} \quad a < c < b < d$$ and in these cases the corresponding function values are $$2f(c), 0, f(c), 0 \quad \text{or} \quad 0, f(c), 0, 2f(c).$$
The intermediate value theorem tells you that the function $f$ must attain the value $\dfrac{f(c)}{2}$ at least three times, contrary to hypothesis. Thus no such function exists.