If $Z$ is another zero object and $\varphi$ is the unique isomorphism between $0$ and $Z$, then the following diagram will commute:
$$
\newcommand{\ra}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!\!\!\!}
\newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.}
%
\newcommand{\ua}[1]{\left\uparrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.}
%
\begin{array}{llllllllllll}
& A & \ra{0_{A,0}} & 0 & \ra{0_{0,B}} & B & \\
& \da{\text{id}} & & \da{\varphi} & & \ua{\text{id}} \\
& A & \ra{Z_{A,0}} & Z & \ra{Z_{0,B}} & B & \\
\end{array}
$$
Edit: by commutativity of the smaller squares, we can calculate
$$\begin{align*}
Z_{A,B} &= Z_{0,B}\circ Z_{A,0} \\
&= \text{id}\circ Z_{0,B}\circ Z_{A,0}\circ\text{id}\\
&= 0_{0,B}\circ\varphi^{-1}\circ Z_{A,0}\circ\text{id}\\
&= 0_{0,B}\circ\varphi^{-1}\circ\varphi\circ 0_{A,0}\\
&= 0_{0,B}\circ 0_{A,0}\\
&= 0_{A,B}
\end{align*}$$
which is the result you wanted. Morally, what happened is that seeing that the smaller squares commuted was easy by the universal property of the zero object. This will always imply that putting them together to get a "larger square" preserves commutativity. So writing the commutative diagram "replaces" the work done by writing out the long list of function equalities like I just did.