The formula is incorrect. Take for instance $\mathbb{Z}$ as ground ring, and $S$ to be the set of all sequences of integers indexed by integers with only finitely many nonzero terms: $S=\bigoplus_{i\in\mathbb{Z}} \mathbb{Z}$ consider now $M$ with $M_0=S$ and all other $M_i=0$. There is a natural map $\psi:M\rightarrow S$ which sends every sequence in $M_0=S$ to the sum of its terms in the corresponding degrees: $\psi(s=(\dots,0,s_{-N},\dots,s_{N},0,\dots))=\sigma=(\sigma_i)_{i\in\mathbb{Z}}$ where for each $i\in\mathbb{Z}, \sigma_i=s_i$... Doesn't this look silly? Have I gone to such lengths to define the identity morphism? $\psi$ is indeed the identity morphism between the two modules, but it is absolutely not the identity morphism between the two graded modules: by construction, $M$ is concentrated in degree $0$ while $S$ has a copy of the integers in every rank. In any case, $\psi$ is by no means a finite sum of morphisms from $M_0$ to different degrees of the graded group $S$.
What this means, is that in general you don't have that a morphism into a direct sum decomposes as a sum of morphisms into each component of the target space. However, if you assume that for all $i$ the group $M_i$ is finitely generated as a $R$-module, then the formula is true!
For completeness sake, you should remember that $\mathrm{Hom}_R(\bigoplus_{i\in I} M_i, N)\simeq\prod_{i\in I}\mathrm{Hom}_R(M_i,N)$ and $\mathrm{Hom}_R(M,\prod_{i\in I} N_i)\simeq \prod_{i\in I}\mathrm{Hom}_R(M,N_i)$ and whenever $M$ is finitely generated as a $R$-module, then $\mathrm{Hom}_R(M,\bigoplus_{i\in I} N_i)\simeq\bigoplus_{i\in I}\mathrm{Hom}_R(M,N_i), $ while generally theright hand side may be a strict subset of the left hand side.