Suppose there is an injective $R$-module homomorphism $f:N\to M$ and a homomorphism $f':M\to N$ that is identity on $N$. I need to show that $f(N)$ is a direct summand of $M$.
My idea is to consider the short exact sequence $$0\to f(N)\to M\to M/f(N)\to 0$$ where the first map is the inclusion $\iota$ and the second map is the projection $\pi$, and to define a map $h:M\to f(N)$ such that $h(\iota(x))=x$ for all $x\in f(N)$. This will imply that $M\simeq f(N)\oplus M/f(N)$.
The condition $h(\iota(x))=x$ is equivalent to $h(x)=x$, this suggests to define $h$ to be the identity. But the identity makes sense only on $f(N)$, and not on the whole $M$. How to define it on the whole $M$? I guess I need to use $f'$ somehow...
I assume that $N\subseteq M$ and $f'$ restricted to $N$ is the identity. Now consider the following short exact sequence: $$0\xrightarrow{} \ker f' \xrightarrow{\subseteq} M \xrightarrow{f'} N \xrightarrow{} 0.$$
By the assumption, the insertion $i:N\to M$ is a right inverse of $f'$, that is, $f'\circ i : N\to N$ is the identity. Therefore our short exact sequence splits.