If $f:[0,1]^2\mapsto\mathbb{R}$ is continuous, then $f$ is not injective
I start by ascerting that, since $[0,1]^2$ is compact, then there are $x_1,x_2\in[0,1]^2$ such that for every $x\in [0,1]^2$ $f(x_1)\leq f(x)\leq f(x_2)$; like this:
So, if I declare the sets $S$ and $S'$ like this:
The curves $f(S)$ and $f(S')$ will take all values between $f(x_1)$ and $f(x_2)$, since they will inherit continuity from $f$.
Thus, $f$ is not injective since $S$ and $S'$ both will have a point that maps to the same value between $f(x_1)$ and $f(x_2)$.
Is this proof correct? Thanks in advance.