I noticed that most proofs given in this answer are from first principle.
However, I am wondering if we can construct an alternative proof, by the following fact:
Theorem: Let $X$ and $Y$ be topological spaces and let $f: X \to Y$ be continuous. If $X$ is connected, then $f(X)$ is connected.
(i.e. the continuous image of a connected set is connected.)
For a topological space $(X, \tau)$ and $E, Cl(E) \in X$ with subspace topology $(E, \tau_E)$ and $(Cl(E), \tau_{Cl(E)})$
If we can find a surjective and continuous map, $f: E \twoheadrightarrow Cl(E)$ (i.e. the image, $f(E)$ is precisely $Cl(E)$), this completes the proof by the above theorem.
However I can't think of a way to construct such $f$.
If we restrict $X$ to be a complete metric space $(X, d)$ with $(E, d)$ being a subspace, the completion of $(E, d)$ is precisely $(Cl(E), d)$.
We know that the completion map is an isometry which is continuous, but I am not sure about the case for $X$ being a general topological space.
Many thanks in advance!
EDIT:
I shall emphasise that my main question is about how to construct such surjective and continuous $f$ from a set to its closure in general.
Consider the set $X$ with $|X|\ge 2$ and $p\in X$ and define
$$\tau_p=\{U\subset X: U=\emptyset \text{ or } p\in U\}$$
Now consider $E=\{p\}$, then $\textrm{cl}(E) =X$
It's easy to show that $\nexists f:E\to \textrm{cl}(E)$ continuous onto map.