Let $g(x)=|f(x)|$, observe that the complex norm is a continuous function from $\mathbb C$ into $\mathbb R$, therefore $g\colon X\to\mathbb R$ is continuous.
Since $X$ is compact and connected the image of $g$ is compact and connected. All connected subsets of $\mathbb R$ are intervals (open, closed, or half-open, half-closed); and all compact subsets of $\mathbb R$ are closed and bounded (Heine-Borel theorem).
Therefore the image of $g$ is an interval of the form $[a,b]$. Let $x_0,x_1\in X$ such that $g(x)=a$ and $g(x_1)=b$.
(Note that the connectedness of $X$ is not really needed, because compact subsets of $\mathbb R$ are closed and bounded, and thus have minimum and maximum.)