Can a connected set be written as the subset of the union of two seperated sets The proof that I am stuck with is to show that

the closure of a connected set is connected.

My attempt goes like this , let $E$ be a connected set and we assume that $\overline{E}$ is not connected. Then it can be written as the union of two separated sets $A$ and $B$ .So , $\overline{E}=A \cup B$.Now , $E \subset \overline{E} =A \cup B$.Hence, $E \subset A \cup B$.I was trying to arrive at a contradiction using this.
There is a proof to this on stackexchange, I know but can someone go through my proof and tell me where is it wrong?
 A: (Getting another question off the unanswered list.)
The problem isn’t that it’s wrong: the problem is that it’s barely the start of a proof. It actually is a reasonable (if slightly flawed) way to begin, but the real work is yet to come.
I said that it’s slightly flawed because if you want to argue by contradiction, it’s not quite enough to say that $A$ and $B$ are separated: after all, a connected set $S$ is the union of the separated sets $S$ and $\varnothing$. The assumption that $\operatorname{cl}E$ is not connected lets you write it as the union of two non-empty separated sets $A$ and $B$, and you can then get a contradiction by showing that in fact one of $A$ and $B$ must be empty after all.
It turns out, though, that you don’t need to argue by contradiction: with only minor modifications the remainder of that argument shows directly that if $A$ and $B$ are separated sets whose union is $\operatorname{cl}E$, then one of them must be empty, and hence $\operatorname{cl}E$ must be connected. I’ll complete the argument that way instead, using your not necessarily non-empty $A$ and $B$.
Let $A_0=A\cap E$ and $B_0=B\cap E$; then
$$A_0\cup B_0=(A\cap E)\cup(B\cap E)=(A\cup B)\cap E=E\,,$$
and
$$A_0\cap\operatorname{cl}B_0\subseteq A\cap\operatorname{cl}B=\varnothing=B\cap\operatorname{cl}A\supseteq B_0\cap\operatorname{cl}A_0\,,$$
so $A_0$ and $B_0$ are separated sets whose union is $E$. $E$ is connected, so one of $A_0$ and $B_0$ must be empty; without loss of generality suppose that $A_0=\varnothing$. Then $B_0=E$, so
$$\operatorname{cl}B\supseteq\operatorname{cl}B_0=\operatorname{cl}E\supseteq\operatorname{cl}B\,,$$
and hence $\operatorname{cl}B=\operatorname{cl}E$.
But then $A=A\cap\operatorname{cl}E=A\cap\operatorname{cl}B=\varnothing$, so we’ve shown that $\operatorname{cl}E$ cannot be written as the union of two non-empty separated sets and hence that it is connected.
