Extending a commutative diagram of exact sequences Let $R$ be a ring and $L_1,L_2,M_2,M_2,N_1,N_2$ $R$-modules. Say you have the following diagram:
$\require{AMScd}$
\begin{CD}
0 @>{}>> L_1 @>{f_1}>> M_1 @>{g_1}>> N_1 @> >> 0\\
@. @V{\alpha}VV @V{\beta}VV @V{\gamma}VV\\
0 @>{}>> L_2 @>{f_2}>> M_2 @>{g_2}>> N_2 @> >> 0
\end{CD}
which is commutative, with exact lines.
Problem: Show that there are a $R$-module $M$ and $R$-module morphisms $\beta_1: M_1 \to M$ and $\beta_2: M \to M_2$ such that $\beta_2 \circ \beta_1 = \beta$ and
$\require{AMScd}$
\begin{CD}
0 @>{}>> L_1 @>{f_1}>> M_1 @>{g_1}>> N_1 @> >> 0\\
@. @V{\alpha}VV @V{\beta_1}VV @V{1}VV\\
0 @>{}>> L_2 @>{f}>> M @>{g}>> N_1 @> >> 0 \\
@. @V{1}VV @V{\beta_2}VV @V{\gamma}VV\\
0 @>{}>> L_2 @>{f_2}>> M_2 @>{g_2}>> N_2 @> >> 0
\end{CD}
is a commutative diagram with exact lines.
Attempt: Given the scenario, the natural path I see is to choose $M = M_1 \oplus M_2$, $f(x) := (0, f_2(x))$ and $g(x,y) := g_1(x)$, which in turn does not work - some squares don't commute, and the middle line is not exact. This left me in a stump, as I can't define any other $f,g$ that do the job.
So, either my choice of $M$ was poorly made, or I am missing something. Can anyone lend me a hand?
 A: I've managed to come up with a solution, following @Roland's suggestion (see comments), which I now post here to close the question.
Define $M = \{(m,n) \in M_2 \times N_1 : g_2(m) = \gamma(n)\}$. In this case, given
\begin{align}
f: L_2 & \to M  \ \ \ \ \ \ \ \ \ \  & g:M &\to N_1 \\
\ell & \mapsto (f_2(\ell),0) \ \ \ \ \ \ \ \ \ \  & (m,n) &\mapsto n
\end{align}
and
\begin{align}
\beta_1f: M_1 & \to M  \ \ \ \ \ \ \ \ \ \  & \beta_2:M &\to M_2 \\
m & \mapsto (\beta(m), g_1(m)) \ \ \ \ \ \ \ \ \ \  & (m,n) &\mapsto n
\end{align}
one has the following.

*

*The sequence
$$\begin{CD}
0 @>{}>> L_2 @>{f}>> M @>{g}>> N_1 @> >> 0
\end{CD}$$
is exact. It is clear that $f$ is injective, $g$ is surjective and $g \circ f = 0$. Thus, it only remains to show that $\operatorname{Ker}g \subseteq \operatorname{Ker}f$. If $(m,n) \in \operatorname{Ker}g$, then $0 = g(m,n) = n \implies 0 = \gamma(n) = g_2(n) \implies n \in \operatorname{Im}f_2$, thus $(m,n) = (f_2(n_0),0)$, for some $n_0 \in L_2$.


*The square
$$\begin{CD}
L_1 @>{f_1}>> M_1 \\
@V{\alpha}VV @V{\beta_1}VV \\
L_2 @>{f}>> M
\end{CD}$$
is commutative, as $\beta_1 \circ f_1(\ell) = \beta_1(f_1(\ell)) = (\beta(f_1(\ell))), g_1(f_1(\ell)) = (f_2(\alpha(\ell), 0) = f_2 \circ \alpha(\ell), \ \forall \ell \in L_2$.


*The square
$$\begin{CD}
M_1 @>{g_1}>> N_1 \\
@V{\beta_1}VV @V{1}VV \\
M @>{g}>> N_1
\end{CD}$$
is commutative, as $g\circ \beta_1(m) = g(\beta(m), g_1(m)) = g_1(m),\ \forall m\in L_2$.


*The square
$$\begin{CD}
L_2 @>{f}>> M \\
@V{1}VV @V{\beta_2}VV \\
L_2 @>{f_2}>> M_2
\end{CD}$$
is commutative, as $\beta_2 \circ f(\ell) = \beta_2(f_2(\ell), 0) = f_2(\ell), \ \forall \ell \in L_2$.


*The square
$$\begin{CD}
M @>{g}>> N_1 \\
@V{\beta_2}VV @V{\gamma}VV \\
M_2 @>{g_2}>> N_2
\end{CD}$$
is commutative, as $g_2 \circ \beta_2(m,n) = g_2(m) = \gamma(n) = \gamma \circ g(m,n), \ \forall (m,n) \in M$.
The result follows.
