You can directly find a solution to the homotopy lifting problem. Suppose you have a commutative diagram
$$\begin{array}{ccc}
A\times\{0\} & \stackrel{g}{\longrightarrow}& X'\\
\downarrow{i} & & \downarrow{f'}\\
A\times I & \stackrel{H}{\longrightarrow} & Y
\end{array}$$
where $i$ is the inclusion to the base of the cylinder $A\times I$.
The map $g$ has two components:
$$
g(a,0)=(g_1(a),g_2(a))\in X'\subseteq X\times Y^I,
$$
and, since $g(a,0)\in X'$ we must have $g_2(a)(1)=f(g_1(a))$.
By commutativity of the diagram we also know that
$$
H(a,0)=f'(g(a,0))=g_2(a)(1)
$$
Hence the endpoint of the path $g_2(a)$ is the starting point of the path $H(a,-)$.
After this observation you can define the lift $\tilde{H}:A\times I\rightarrow X'$. Notice that $\tilde{H}$ has two components
$$
\tilde{H}_1:A\times I\rightarrow X\\
\tilde{H}_2:A\times I\rightarrow Y^I
$$
Define
$$
\tilde{H}_1(a,t):=g_1(a)
$$
and $\tilde{H}_2(a,t)$ as the path which runs along the path $g_2(a)$ and then continues along $H(a,-)$, ending at $H(a,t)$ (remember, the endpoint of $g_2(a)$ is the beginning of $H(a,-)$).
Explicitly:
$$
\tilde{H}_2(a,t)(s):=
\begin{cases}
g_2(a)((1+t)s) & \text{ if } 0\leq s\leq 1/(1+t)\\
H(a,((1+t)s-1) & \text{ if } 1/(1+t)\leq s\leq 1.
\end{cases}
$$
I will leave to you to verify that $\tilde{H}$ is indeed a lift and that it is continuous.