The problem here is about categorical construction of free groups, as in Lang's algebra (p.66-68).
Theorem: For any set $S$, there exists free group $(F,f)$ determined by $S$ (here $f:S\rightarrow F$).
Lines of proof:
(1) There exists a set $I$ and a family $\{G_i\}_{i\in I}$ of groups such that if $g:S\rightarrow G$ is a map such that $g(S)$ generates $G$, then $G\cong G_i$ for some $i$.
(2) For each $i\in I$, let $M_i$ be the set of all maps from $S$ to $G_i$.
(3) If $\varphi\colon S\rightarrow G_i$ is in $M_i$, then let $G_{i,\varphi}$ denote the pair $(G_i,\varphi)$.
(4) Take $F_0=\prod_{i\in I} \prod_{\varphi\in M_i} G_{i,\varphi} $.
Up to this, I have understood arguments. My question is based on next one. Lang writes
We define a map $f_0\colon S\rightarrow F_0$ by sending $S$ on the factor $G_{i,\varphi}$ by means of $\varphi$ itself.
Question 1. I didn't understand the map $f_0$, since, what is $\varphi$ here?Are we taking some specific factor $G_{i,\varphi}$ in $F_0$ above?
After this, Lang continue the proof as
We contend that given map $g: S\rightarrow G$ into a group $G$, there exists a homomorphism $\psi_*:F_0\rightarrow G$ such that $\psi_*\circ f_0=g$...... Let $F$ be the subgroup of $F_0$ generated by $f_0(S)$. Then $F$ is the required free group on $S$.
Question 2. What is the purpose of direct product in $F_0$ instead of direct sum? I mean, will the proof work with direct sum?
A map $\Phi:S\rightarrow \prod_{j\in J} E_j$ is the same thing as a family of maps $(\Phi_j:S\rightarrow E_j)_{j\in J}$, where $\Phi_j$ is just the $j$-th coordinate in $\prod_{j\in J} E_j$.
So to give a map $f_0:S\rightarrow\prod_{i\in I}\prod_{\varphi\in M_i} G_{i,\phi}$, it is enough to give each "coordinates". For the coordinate corresponding to $(i,\varphi)$, the map will be $\varphi$ itself.
Hopefully it answers your first question. It should answer your second question as well : the map $f_0$ is non-zero on an infinite number of factors, so you cannot replace the products by direct sums.
By the way, direct sums are ill-behaved for non abelian groups. The good notion for them is the free product $G\star H$. But, free groups are just special cases of free products : the free group over $S$ is just $\bigstar_{s\in S}\mathbb{Z}$.