I have to show that $Y$ is path-connected if and only if: if X is any topological space and $f,g: X\to Y$ are nullhomotopic, then $f,g$ are homotopic.
I understand that if Y is path-connected then $f,g$ are homotopic, but how can I show the other direction.
Couldn't we just add a single point to $Y$ so that it's not path-connected?
For the other direction take $X=\{pt\}$ for two point $x,y \in Y$ define the maps $f_1(pt)=x$ and $f_2(pt)=y$. From this conclude that $Y$ is path connected. For any other space $X$ just take constant maps.
If we add another point $pt'$ to $Y$ then we will have another map $f'(pt)=pt'$ and this map won't be homotopic to any other map