To paraphrase Serge Lang, Algebra: Proposition 2.1.
Let $X$, $X^\prime$, $X^{\prime\prime}$ and $Y$ be modules over some ring $A$. (The ring does not change, and will therefore not be mentioned anymore to avoid notational overload) The sequence $$ X^\prime \xrightarrow{\lambda} X \xrightarrow{\mu} X^{\prime\prime} \rightarrow 0 \tag{1} $$ is exact if and only if the sequence $$ 0 \rightarrow \text{Hom}(X^{\prime\prime}, Y) \xrightarrow{m_\mu} \text{Hom}(X, Y) \xrightarrow{m_\lambda} \text{Hom}(X^\prime, Y) \tag{2} $$ is exact for all $Y$. (Lang uses the notation $\text{Hom}(\lambda, Y)$ to denote what I call $m_\lambda$, but I think the latter is more notationally convenient)
Proof.
Suppose the first sequence is exact. Consider a homomorphism $g: X \rightarrow Y$ such that $$ X^\prime \xrightarrow{\lambda} X \xrightarrow{g} Y $$ is $0$. Then $g$ must vanish on the image of $\lambda$, implying that we can factor it through $X/\text{Im}$ $\lambda$. But since $X\rightarrow X^{\prime\prime}$ is surjective, we have an isomorphism $X/\text{Im}$ $\lambda\cong X^{\prime\prime}$, so that we can factor $g$ through $X^{\prime\prime}$, which shows that the kernel of $m_\lambda$ is contained within the image of $m_\mu$. The rest of the proof is then left to the reader.
From my understanding of exact sequences, what is now left to prove is that the image of $m_\mu$ is contained within the kernel of $m_\lambda$, and that $m_\mu$ is injective, as well as the entire converse statement. We begin by explicitly writing the action of $m_\mu$ (resp. $m_\lambda$) on an element $h\in\text{Hom}(X^{\prime\prime},Y)$: $$ m_\mu(h) = h\circ\mu \in \text{Hom}(X,Y) $$ First we show that $m_\mu$ is injective. Let $k = m_\mu(h)$ and $k^\prime = m_\mu(h^\prime)$ be elements of $\text{Hom}(X,Y)$. Let $k = k^\prime$. We then have: $$ h-h^\prime = k\circ\mu - k^\prime\circ\mu = (k-k^\prime)\circ\mu = 0\circ\mu = 0 \tag{3} $$ showing that if $k = k^\prime$, then $h = h^\prime$ and $m_\mu$ is surjective. The last equality in $(3)$ follows from the fact that $\mu$ is surjective.
Now we show that $\text{Im}(m_\mu) \subset \text{ker}(m_\lambda)\Leftrightarrow m_\lambda(m_\mu(h)) = 0$ for all $h \in \text{Hom}(X^{\prime\prime},Y)$. We know that since $(1)$ is exact, $\mu(\lambda(x)) = 0$ for all $x \in X^\prime$. Let $h\in\text{Hom}(X^{\prime\prime}, Y)$ and $f = h \circ \mu \circ \lambda\in\text{Hom}(X^\prime,Y)$. But then $f(x) = h(\mu(\lambda(x)) = h(0)$, which must be $0$ since $h$ is a module-homomorphism. But since this must hold for all $x\in X^\prime$, we have $h\circ\mu\circ\lambda\equiv m_\lambda(m_\mu(h)) = 0$ and therefore the image of $m_\mu$ is contained in the kernel of $m_\lambda$.
However, I struggle really hard with the converse implication. For starters, I would like to know if I can conclude the surjectivity of $\mu$ from the injectivity of $m_\mu$, by inverting the reasoning in $(3)$ (essentially putting the zero on the left side of the expression and concluding that if $0\circ\mu = 0$, then $\mu$ must be surjective). For the equality of $\text{Im}$ $\lambda$ and $\text{ker}$ $\mu$, some pointers about which direction to go for a proof would be fine, I do not need/want a complete walkthrough.