Suppose $f,g:[0,1]\to [0,1]$ are two maps then we have that $f$ is homotopic to $g$ since $[0,1]$ is a convex space and if $h:[0,1] \to X$ is a path in an arbitrary space $X$, it implies $h \circ f$ homotopic to $h \circ g$ since homotopy is invariant under composition.
Now, if I take $f=Id_{[0,1]}$ and $g=0$, then this implies $h \circ f = h$ is homotopic to $h \circ g = c_{h(0)}$ i.e any path in $X$ is homotopic to a constant map which is not true in general.
What am I missing here ?