Consider a right $R$-module $M$ with a reduced endomorphism ring $S=\text{End}_R(M)$. If $M=f(M)+\ker(f)$ for every $f\in S$, then prove that $S$ is a regular ring.
I tried to prove that in the following manner:
Let $f\in S$. Then for each $m\in M,m=f(n)+b$ for some $n\in M$ and $b\in \ker(f)$. Then $f(m)=f^2(n)$. It follows that $f\in Sf^2$ and $f=gf^2$. This proves that $S$ is a strongly regular ring.
More ideas: Since for each $m\in M,f(m)=f^2(n)$ for some $n\in M, f(M)=f^2(M)$. Now we claim that $\ker(f)=\ker(f^2)$ for each $f\in S$. Suppose not. Then $\ker(f)\subset\ker(f^2)$ and $$M=\ker(f)+f(M)=\ker(f)+f^2(M)\subset \ker(f^2)+f^2(M)=\ker(f^2)+f(M)\subseteq M=\ker(f)+f(M),$$ which is contradiction. Thus $\ker(f)=\ker(f^2)$ for each $f\in S$. But again $\ker(f)=\ker(f^2)$ implies $\ker(f)\cap f(M)=0$. Hence $M=\ker(f)\oplus f(M)$. This proves that $S$ is regular.
Is this proof okay? I am requesting for some help.