A direct limit concerning some homomorphisms In an algebra text there is the following argument I am stuck in the last part of which:
"Let $f:B→C$ be an epimorphism in the category of $R$-modules, and $D=∑_{n=1}^∞c_nR$ be a countably generated submodule of $C$. Suppose we have homomorphisms $g_n∈Hom_R(C,B)$ for $n=1,2,...$ with the property that $f\circ g_n(c_i)=c_i$ for $1≤i≤n$, also we know that $g_n$ is the same as $g_{n-1}$ on $∑_{i=1}^{n-1}c_iR$. By taking direct limit, we obtain a homomorphism $g∈Hom_R(D,B)$ whose restriction to $∑_{i=1}^{n}c_iR$   is given by $g_n$ for any $n$."
My problem is from "...By taking direct limit". Thanks for any help!
 A: Given any ascending sequence of sets $X_1\subset X_2\subset X_3\cdots\subset X$ with $\bigcup_{n\ge1}X_n=X$ and any collection of functions $g_i:X_i\to Y$ such that $g_i|_{X_{i-1}}=g_{i-1}$, we can form the map $g:X\to Y$ defined by the relation $g(x)=g_i(x)$ whenever $x\in X_i$. Each function $g_i$ is a bigger and bigger "glimpse" of $g$.
One can check this idea works in other concrete categories; one can glue homomorphisms to get homomorphisms out of the union of an ascending sequence of subobjects in rings, groups, modules..
A: Let $N_n=\sum_{i=1}^{k}c_iR$; then $D$ is the union of the increasing family of submodules $N_n$ and as such it is its direct limit with inclusions as transition maps.
If you consider the restriction $h_n$ of $g_n$ to $N_n$, the given condition translates into the fact that $h_n\colon N_n\to B$ is a family of morphisms compatible with the inclusion maps, so there is a unique morphism
$$
g\colon D=\lim_{\to} N_n\to B
$$
such that the composition $N_n\hookrightarrow D\xrightarrow{g} B$ is $h_n$ (for all $n$).
