Let R be a ring with unit, $X$ a set and $\{ M_x \}_{x \in X}$ a family of $R$ modules. I will try to construct the direct sum $\bigoplus_{x \in X}Mx$
First, as a set, $\bigoplus_{x \in X}M_x$ is necessarily a product of the sets $M_x$, because the forgetful functor $U: R Mod \rightarrow Set$ preserves limits. So we set $\bigoplus_{x \in X}M_x = \Pi_{x \in X}M_x$
Any inclusion $\iota_{a}: M_a \rightarrow \Pi_{x \in X}M_x$ in a direct sum has to satisfy:
$$\pi_x \circ \iota_a = \begin{cases} 1, \text{if } x = a \\ 0, \text{if } x \neq a \end{cases}$$
this uniquely determines $\iota_a$.And it can be show $\iota_a$ is a R-mod morphism.
Is $\{\iota_x: M_x \rightarrow \Pi_x M_x \}_{x \in X}$ a coproduct? If so, I will have succeeded in constructing arbitrary direct sum.
The direct product $\Pi_{x\in X} M_x $ is not a coproduct if the index set $X$ is infinite. To see this, let $$A = \{(m_x)_{x\in X} \mid m_x = 0 \text{ for all but finitely many } x\in X\}\subset \Pi_{x\in X}M_x,$$ and let $f_x:M_x\to \Pi_{x\in X}M_x$ and $q_x: M_x\to A$ be the natural inclusions. Now show the following:
Alternatively, prove directly that $A$ with the associated maps $q_x$ is the coproduct. Note that $A\simeq \Pi_{x\in X}M_x$ if and only if the index set $X$ is finite.