I've seen that are one or two questions like this, but I'm not fully convinced that are right. Both pretty much say the same thing, so I leave the easier to understand:
path connectedness implies connectedness
The thing I'm not quite sure, is that if $f$ is a path, then I have that $f(0)=a$ and $f(1)=b$ for some $a,b \in X$. But the demonstration, uses that $\DeclareMathOperator{\Im}{Im}\Im(f)=X$ which, as far as I know, it's not necessarily true.
One thing I thought, but I'm not sure if is right as a proof, is that since every point in $X$ can be joined with a path, and I can join two different paths, I can make an uncountably union of paths to join every point of $X$ and then I could apply the link before, but, for example, I might have a problem if $X$ has more elements than $\mathbb{R}$.
What I was thinking is mostly the same, but when I was about to take $$f^{-1}(\Im(f)) = f^{-1}(\Im(f) \cap M) = f^{-1}(\Im(f) \cap (U \cup V)) = f^{-1}((\Im(f)\cap U) \cup (\Im(f) \cap V))$$ I realized that $\Im(f) \cap U$ might not be open, so this wouldn't imply that $[0,1]$ is disjoint, so I don't have a contradiction.