The following theorems appear many places in books and on this site also.
Sub-modules of a free module are free, provided the ring of scalars is P.I.D.
If $R$ is not P.I.D. then sub-module of a free $R$-module may not be free.
I have gone through the proof of theorem as well as counterexample. But my next question comes from these two facts:
Let $M$ is an $R$-module (and assume that $M$ has proper sub-modules). If $R$ is not a P.I.D., then is it necessary that there exists a sub-module of $M$ which is not free?
Yes.
If $M$ is not free, then the result is trivial.
Assume that $M$ is free. Then $M$ contains a copy of $R$, so it is sufficient to prove the claim for $R$.
Since $R$ is not a PID, then either it contains a non-principal ideal, or it is not an integral domain. In the latter case, let $a$ be a zero-divisor; then the submodule of $R$ generated by $a$ is not free.
Finally, assume that $R$ is an integral domain, and let $I$ be a non-principal ideal of $R$. If $I$ were a free $R$-module, then it would admit a basis $(x_j)_{j\in J}$, with $J$ a set containing at least two elements. But then, for any $i\neq j$ in $J$, we would have $$ x_ix_j - x_jx_i = 0, $$ contradicting the linear independence of $x_i$ and $x_j$. Thus $I$ is not a free module.