I'm trying to show that if $F$ is a free $R-$module and $g:M\rightarrow F$ is a surjective $R-$homomorphism then $M \simeq Ker(f)\oplus F$.
What I have done so far:
Let $X=\{x_i\}_{i\in I}$ be a base for $F$, define the $R-$homomorphism $h:F\rightarrow M$, taking for each $x_i \in X$ an element $m_i \in M$ such that $g(m_i)=x_i$ and define $h(x_i)=m_i$ then extend it by linearity
Then, for each $n \in F$, we have $g\circ h(n)=g(h(\sum_{i\in I}\lambda_ix_i))=\sum_{i\in I}\lambda_ig(h(x_i))=\sum_{i \in I}x_i=n$
and $$h(n)=h(n') \Rightarrow h(n-n')=0 \Rightarrow g(h(n-n'))=g(0)=0 \Rightarrow n-n'=0 \Rightarrow n=n'$$
Hence, $h $ is injective and then $F\simeq h(F)$
Now, let $m\in h(F) \cap Ker(g)$, then $g(m)=0$ and $m=h(n)$ for some $n\in F$, it follows that $$g(h(n))=g(m)=0\Rightarrow n=0\Rightarrow h(n)=m=0$$
What have I done so far is acceptable?
What I'm trying to do now is show that every element of $M$ can be written as a sum $y+k$ with $y \in Im(h)$ and $k \in Ker(g)$ and then i think the conclusion follows easily.
P.S: Sorry for grammar mistakes, I learned English with video games.
You can prove this essentially as with vector spaces. Let $F$ be free with basis $\{ x_i : i\in I\}$ and for each of these basis elements choose $m_i\in M$ so that $f(m_i) = x_i$: this can be done because $f$ is surjective.
Because $F$ is free, there is a map $g : F\to M$ such that $g(x_i) = m_i$ and by construction $fg$ is the identity of $F$. This means that $g$ is injective, so $F' = g(F)$ identifies $F$ with a submodule of $M$. Let $K=\ker f$, and let us show that $M=K\oplus F'$.
Certainly we have $K\cap F' = 0$: if $m = g(x)$ and $f(m)=0$ then $f(m)=x=0$. Given $m\in M$, let $n = gf(m)$, and write $m = (m -n) +n$. To conclude, we note that $m-n\in K$ since $f(m-n)$ $= f(m) - fgf(m)$ $= f(m)- f(m)=0$ because $fg=1$, while $n$ is, by construction, in $F'$.