HINT: The line segment from $a$ to $b$ consists precisely of the points $(1-t)a+tb$ for $0\le t\le 1$.
Okay, that was pretty minimal; I should say a bit more. You could use it if you could find a finite set of points $x_0=a,x_1,\dots,x_n=b$ in $X$ and $\epsilon_k>0$ for $k=0,\dots,n$ such that $B(x_k,\epsilon_k)\subseteq X$ for $k=0,\dots,n$ and $B(x_k,\epsilon_k)\cap B(x_{k+1},\epsilon_{k+1})\ne\varnothing$ for $k=0,\dots,n-1$. Try to prove that such a chain from $a$ to $b$ exists.
To get you started, for each $x\in X$ there is an $\epsilon(x)>0$ such that $B(x,\epsilon(x))\subseteq X$. Let $Z$ be the set of points of $X$ that can be reached from $a$ by a finite chain of these sets $B(x,\epsilon(x))$ as described in the previous paragraph. Show that $Z$ is a non-empty clopen subset of $X$ and hence must be all of $X$.