I know there already exists this problem, however, it does not answer my question.
As it's mentioned in the linked question, the theorem goes as:
Theorem 2.47: A subset $E$ of the real line $\mathbb{R}^1$ is connected if and only if it has the following property: If $x \in E$, $y \in E$, and $x < z < y$ then $z \in E$.
Proof: To prove the converse suppose that $E$ is not connected. Then there are nonempty separated sets $A \text { and } B$ such that $A \cup B = E$. Pick $x \in A, y \in B$ and assume (without loss of generality) $x < y$. Define
$$z = \sup(A \cap [x,y])$$
By Theorem 2.28, $z \in \overline{A}$; hence $z \not\in B$. In particular, $x \leq z < y.$ If $z \not \in A$, it follows that $x < z < y$, and $z \not\in E$. If $z \in A$, then $z \not\in \overline{B}$, hence there exists $z_1$ such that $z < z_1 < y \text { and } z_1 \not\in B$. Then $x < z_1 < y$ and $z_1 \not \in E$. $_\Box$
My problem is with the part that it says
$$z = \sup(A \cap [x,y])$$
By Theorem 2.28, $z \in \overline{A}$
Why is $z \in \overline{A}$ if $z \in \overline{A \cap [x,y]}$?