[proofplan]
We construct a homotopy from $g_0 \circ f_0$ to $g_1 \circ f_1$ by defining $H(t, x) = G(t, F(t, x))$, where $F$ is a homotopy from $f_0$ to $f_1$ and $G$ is a homotopy from $g_0$ to $g_1$. Continuity of $H$ follows from the fact that it is a composition of continuous maps. The boundary values at $t = 0$ and $t = 1$ are verified directly.
[/proofplan]
[step:Construct the homotopy $H$ as a composition]
Let $F: [0,1] \times X \to Y$ be a homotopy from $f_0$ to $f_1$, so $F(0, \cdot) = f_0$ and $F(1, \cdot) = f_1$. Let $G: [0,1] \times Y \to Z$ be a homotopy from $g_0$ to $g_1$, so $G(0, \cdot) = g_0$ and $G(1, \cdot) = g_1$. Define
\begin{align*}
H: [0,1] \times X &\to Z \\
(t, x) &\mapsto G(t, F(t, x)).
\end{align*}
[/step]
[step:Verify continuity of $H$]
The map $H$ can be written as the composition
\begin{align*}
[0,1] \times X \xrightarrow{\Delta \times \operatorname{id}_X} [0,1] \times [0,1] \times X \xrightarrow{\operatorname{id}_{[0,1]} \times F} [0,1] \times Y \xrightarrow{G} Z,
\end{align*}
where $\Delta: [0,1] \to [0,1] \times [0,1]$ is the diagonal map $t \mapsto (t, t)$. Each map in this composition is continuous: $\Delta \times \operatorname{id}_X$ is continuous because $\Delta$ and $\operatorname{id}_X$ are; $\operatorname{id}_{[0,1]} \times F$ is continuous because both factors are; and $G$ is continuous by hypothesis. Hence $H$ is continuous as a composition of continuous maps.
[guided]
Why do we use the same parameter $t$ in both $F$ and $G$? The idea is to "deform $f$ and $g$ simultaneously": at time $t$, we first apply $F(t, \cdot)$ (which is partway between $f_0$ and $f_1$) and then apply $G(t, \cdot)$ (which is partway between $g_0$ and $g_1$). This simultaneous deformation is the simplest way to get a homotopy from $g_0 \circ f_0$ to $g_1 \circ f_1$.
To verify continuity rigorously, we express $H$ as a composition of continuous maps. Define $\Psi: [0,1] \times X \to [0,1] \times Y$ by $\Psi(t, x) = (t, F(t, x))$. The map $\Psi$ is continuous: its first component is the projection $(t, x) \mapsto t$, and its second component is $F$, both of which are continuous. Then $H = G \circ \Psi$, and since $G$ is continuous, so is $H$.
[/guided]
[/step]
[step:Verify the boundary values]
At $t = 0$: $H(0, x) = G(0, F(0, x)) = g_0(f_0(x)) = (g_0 \circ f_0)(x)$.
At $t = 1$: $H(1, x) = G(1, F(1, x)) = g_1(f_1(x)) = (g_1 \circ f_1)(x)$.
Hence $H$ is a homotopy from $g_0 \circ f_0$ to $g_1 \circ f_1$, and we conclude $g_0 \circ f_0 \simeq g_1 \circ f_1$.
[/step]