# Difference between homotopy function and homotopic space

I'm having some troubles understanding the concept of homotopy and homotopic spaces. I understood that given two function $$f,g:X\to Y$$ we can say that there's an homotopy from $$f$$ to $$g$$ if $$\exists$$ a continuous $$H:X\times [0,1]\to Y$$ such as $$H(x,0)=f(x)$$ and $$H(x,1)=g(x)$$, and that two spaces $$X,Y$$ are homotopic equivalent if we can find two function $$h:X\to Y$$ and $$k:Y\to X$$ such as $$h\circ k\simeq\operatorname{id}_{Y}$$ and $$k\circ h\simeq\operatorname{id}_{X}$$.
My problem is that I can't understand how the fact that I have and homotopy between two function interact with the space used by the function.
To clarify I'll give you an example: let's say that I have a function $$F:D^2\to X$$ which is homotopic to cost$$:D^2\to X$$, the map that $$\forall x\in D^2$$ cost(x)=c with $$c\in\ X$$. What properties does $$D^2$$ get from the existence of those two homotopic function?

The main idea is that a homotopy encompasses the notion of a 'continuous' deformation. The fact that two maps are homotopic means that one map can be 'deformed' into the other. For example, consider two maps $$f,g: I\to \mathbb{R}^2$$ with the same endpoints. Intuitively, these maps will look like two strings with the same endpoints, and you can imagine that you can deform either one into the other. Since this process is continuous, we say that $$f$$ and $$g$$ are homotopic to one another.
On the other hand, two spaces $$X$$ and $$Y$$ are homotopy equivalent if one can be 'continuously' deformed into the other, and viceversa. This can be expressed by saying that a map $$f: X\to Y$$ is a homotopy equivalence, which means there exists a homotopy inverse $$g: Y\to X$$ to $$f$$, i.e. the composition of these maps is homotopic to the identity.
For example, the cylinder and the circle are homotopy equivalent. Why? Consider the inclusion of $$S^1$$ into the cylinder, and consider a map from $$S^1\times I$$ to $$S^1$$ given by 'squashing' the cylinder into the bottom circle. The composition of these maps, in either order, amounts to doing nothing in each of the spaces, and thus it is homotopic to the identity map.