I am leaning about modules and I did not understand what is the motivation behind an $R$ module $M$ as an abelian group in the definition of the module.
What difference does it make if we consider $M$ as non abelian group? Isn't considering only abelian groups much more restrictive than considering an arbitrary group?
Let $G$ be a group, $R$ a ring and assume there is an "$R$-module structure on $G$" (something satisfying the usual axioms except we don't require $G$ to be abelian). Then, let $x,y\in G$ be arbitrary and consider that $2.(xy)=(2.x)(2.y)=(1.x)(1.x)(1.y)(1.y)=x^2y^2$ on one hand and $2.(xy)=(1.xy)(1.xy)=(1.x)(1.y)(1.x)(1.y)=xyxy$ on the other hand (we use the distributive law for the product $xy$ and the sum $2=1+1$ in both orders). This implies $xy=yx$. Since $x,y$ were arbitrary, it follows that $G$ is abelian. Thus, there was no loss of generality in requiring $G$ to be abelian to begin with.
Here's a more conceptual explanation of what just happened. The remarkable property of an abelian group $A$ is that the pointwise sum of two homomorphisms is again a homomorphism, which implies that the endomorphisms of $A$ form a ring $\mathrm{End}(A)$. It's an exercise to check that an $R$-module structure on $A$ is the same thing as a ring homomorphism $R\rightarrow\mathrm{End}(A)$. From this perspective, it is only natural to require an abelian group in the definition of an $R$-module. Now, if $G$ is just a group, we still have a multiplicative monoid $\mathrm{End}(G)$ and an $R$-module structure on $G$ is the same thing as a multiplicative monoid homomorphism $R\rightarrow\mathrm{End}(G)$ such that the addition in $R$ gets transformed into the pointwise multiplication in $\mathrm{End}(G)$ (in particular, the pointwise multiplication of two endomorphisms in the image has to be an endomorphism again). The image of this map is then a submonoid of $\mathrm{End}(G)$ that is closed under pointwise multiplication and forms a ring with pointwise multiplication as addition. In particular, the pointwise multiplication of $\mathrm{id}_G$ with itself, i.e. the squaring map, is an endomorphism. The above argument is just the good old exercise that if $G\rightarrow G,\,x\mapsto x^2$ is a homomorphism, then $G$ is abelian.