Let $X$ be a topological space and $x_0 \in X.$ Given $[g], [h] \in \pi_1 (X, x_0)$ define a map $H : I \times I \longrightarrow X$ by
$$H (t,s) = \begin{cases} h \left (\frac {3t} {1 - s} \right ) & \text {if}\ 0 \leq t \leq \frac {1 - s} {3} \\ g \left ( \frac {3t + s -1} {1 + 2 s} \right ) & \text {if}\ \frac {1 - s} {3} \leq t \leq \frac {2 + s} {3} \\ \overline h \left (\frac {3t - s - 2} {1 - s} \right ) & \text {if}\ \frac {2 + s} {3} \leq t \leq 1 \end{cases}$$
Doesn't it mean that $h \ast g \ast \overline h$ is based homotopic to $g$ in $X\ $? But if it's the case then this is true for any two loops $g$ and $h$ in $X$ based at $x_0.$ But this in turn implies that $\pi_1 (X, x_0)$ is abelian, which is not necessarily true. Where did I go wrong?
Any help would be highly appreciated. Thanks for your time.
EDIT $:$ The homotopy diagram I mentioned is the following $:$
Remark $:$ Another point is that although $h \ast g \ast \overline h$ is not homotopic to $g$ as based loops in $X$ they are indeed homotopic as non-based loops in $X.$ The following gives one such homotopy. Consider $K : I \times I \longrightarrow X$ defined by
$$K (t,s) = \begin{cases} \overline h (s -3t) & \text {if}\ 0 \leq t \leq \frac {s} {3} \\ g \left ( \frac {3t - s} {3 - 2 s} \right ) & \text {if}\ \frac {s} {3} \leq t \leq \frac {3 - s} {3} \\ \overline h (3t + s - 3) & \text {if}\ \frac {3 - s} {3} \leq t \leq 1 \end{cases}$$
