It is required to prove that there exists a continuous function $f:\mathbb{R}\to\mathbb{R^2}$ such that $f(\mathbb{Z})=\mathbb{Z^2}$. The following is my attempt.
Let $f:\mathbb{Z}\to\mathbb{Z^2}$ be a bijection (the existence of such a function is guaranteed by the equinumerosity of $\mathbb{Z}$ and $\mathbb{Z^2}$ ). Then $f:\mathbb{Z}\to\mathbb{R^2}$ is such that $f(\mathbb{Z})=\mathbb{Z^2}$. Moreover $f$ is continuous as the topology on $\mathbb{Z}$ is discrete as a subspace of $\mathbb{R}$, and $\mathbb{Z}$ is closed. Therefore by Tietze's extension theorem $f$ can be extended continuously over $\mathbb{R}$. Now we have the required result.
Is my proof alright? Please help. Thanks.