I was stuck in the following
Problem. Suppose that $\mathcal A$ is an additive category and $f\colon X\to Y$ is a morphism of (cochain) complexes in $\mathcal A$. Then there is a factorization $f=gf'$ where $g$ is a homotopy equivalence and each $(f')^i$ is a monomorphism admitting a retraction.
What I have tried:
Firstly I considered the mapping cone $\mathrm{Cone}(f)$. Although tried, I was not able to figure out a way of defining morphisms $f'\colon X\to\mathrm{Cone}(f)$ and $g\colon \mathrm{Cone}(f)\to Y$ satisfying $f=gf'$.
On a second thought, I considered the product $X\oplus Y$. If I define $f'=\left(\begin{smallmatrix}\mathrm{id}_X\\f\end{smallmatrix}\right)\colon X\to X\oplus Y$ and $g=(0,\mathrm{id}_Y)\colon X\oplus Y\to Y$, then $f'$ and $g$ are morphisms between complexes and $f=gf'$. However, though such an $f'$ is a monomorphism and has a retraction, it is not clear to me whether $g$ is a homotopy equivalence.
Hence I would like to ask for some hints for this problem (maybe I lack some prerequisite knowledge and it is not wise to directly construct such a factorization?)
Any help is greatly appreciated.
$\operatorname{Cone}(f)$ won't work since it is a complex which measures the "difference" between $X$ and $Y$ so this is neither equivalent to $X$ nor to $Y$.
Similarly, $X\oplus Y$ won't work since it is a complex which measure the "sum" of $X$ and $Y$, so this is neither equivalent to $X$ nor to $Y$.
But the Cone idea is a good one, you just need to change it a bit :
Consider $Z=\operatorname{Cone}(f)[-1]$ and the map $u:Z\to X$. Then $\operatorname{Cone}(u)$ does what you want :
Now we construct the natural map $P:\operatorname{Cone}(u)\to Y$. First note that $$\operatorname{Cone}(u)^i= X^i\oplus Z^{i+1}=X^i\oplus \operatorname{Cone}(f)[-1]^{i+1}=X^i\oplus Y^i\oplus X^{i+1}$$ and the differential is given by the matrix $$D=\begin{pmatrix} d&0&1\\0&d&f\\0&0&-d\end{pmatrix}$$
$$ S:X^i\oplus Y^i\oplus X^{i+1}\xrightarrow{\begin{pmatrix}0&0&0\\0&0&0\\1&0&0\end{pmatrix}}X^{i-1}\oplus Y^{i-1}\oplus X^i$$ Check that $SD+DS=\operatorname{id}-IP$
By the way, this construction is called the mapping cylinder of $f:X\to Y$. If you know some algebraic topology, you can get the intuition from there.