I draw a unit circle's first quadrant as in figure $1$ and define $y$ in terms of $n$ as $y=\sqrt{1-n^2}$. I can also plot this in MATLAB or Python.
But if all four quadrants of the unit circle forms a periodic function as in figure $2$, how is $y$ defined in terms of $n$? I want to plot that function in figure $2$ but cannot define it.
I dont want an angular variable, I want $y$ in terms of only $n$ for $n\geq0$.

Your first semicircle is $y=\sqrt{1-(1-n)^2}$. The whole graph is $y=\pm\sqrt{1-(N-n)^2}$ where $N$ is the closest odd integer to $n$ and the sign is chosen by whether $N \equiv 1 \pmod 4$, where it is positive, or $N \equiv 3 \pmod 3$, where it is negative.