Proof of "the continuous image of a connected set is connected"
$f^{-1}(A) \cup f^{-1}(B)$ may be larger than $E$, but it must contain $E$: if $x \in E$, $f(x) \in f(E) = A \cup B$. Then either $f(x) \in A$ or $f(x) \in B$. In the first case, $x \in f^{-1}(A)$, and in the second $x \in f^{-1}(B)$. (The fact that $f^{-1}(A) \cup f^{-1}(B)$ may be larger than $E$ is the reason for intersecting with $E$ when defining $G$ and $H$.)