Let $X$ be a subset of the real line. Then the following two statements are logically equivalent:
(a) $X$ is bounded and connected.
(b) $X$ is a bounded interval.
MY ATTEMPT
Let us try to prove $(a)\Rightarrow(b)$ first.
If $X\subseteq\textbf{R}$ is connected, then for every $x < y$ such that $x,y\in X$ we have that $[x,y]\subseteq X$.
Let us suppose that $X$ is not empty. Since it is bounded, there exists $\inf(X) = m$ and $\sup(X) = M$.
Without loss of generality, we may assume that $m\in X$ and $M\in X$.
Consequently, due to the given assumption, the interval $[m,M]\subseteq X$.
Now it remains to prove that any real number $z\in\textbf{R}\backslash[m,M]$ does not belong to $X$.
Let us suppose otherwise. If $z\in\textbf{R}\backslash[m,M]$ and $z\in X$ there are two possibilities: $z > M$ or $z < m$.
In the first case, according to the properties of the supremum, we conclude that $M < z \leq M$, which is a contradiction.
Similarly, according to the properties of the infimum, we have that $m \leq z < m$, which is also a contradiction.
Therefore $X = [m,M]$ and we are done.
Let us try to prove the implication $(b)\Rightarrow(a)$ now.
Without loss of generality, we can assume that $X = [a,b]$. Thus given two real numbers $x < y$ in $X$, we have that $a\leq x < y \leq b$. Thus $[x,y]\subseteq X$, and we are done.
Is the wording of my proof correct?
When you start with a bounded, connected set $X\subseteq\Bbb R$, it is perfectly legitimate to let $m=\inf X$ and $M=\sup X$, but you may not assume without loss of generality that $m,M\in X$. It is entirely possible that $X=(0,1)$, say, or $[0,1)$. What you need to show is that $X$ is one of the four sets $(m,M)$, $[m,M)$, $(m,M]$, and $[m,M]$.
You do know that $X\subseteq[m,M]$, just by the definition of the infimum and supremum; there is no need to prove this. The next step is to show that $(m,M)\subseteq X$. To do this, let $x\in(m,M)$. Since $m=\inf X$ and $m<x$, there is some $x_0\in X$ such that $x_0<x$. Similarly, $M=\sup X$ and $x<M$, so there is an $x_1\in X$ such that $x<x_1$. but then $x\in[x_0,x_1]$, and $X$ is connected, so $x\in[x_0,x_1]\subseteq X$. We now know that $(m,M)\subseteq X\subseteq[m,M]$, and this immediately implies that $X$ is one of the four sets $(m,M)$, $[m,M)$, $(m,M]$, and $[m,M]$, depending on which of $m$ and $M$ (if either) belongs to $X$. All of these are intervals, so the proof that (a) implies (b) is complete.
To prove the opposite implication, you must show that every bounded interval $X$ is a bounded, connected set. Here again you may not assume without loss of generality that $X$ is a closed interval: you must prove the result for all bounded intervals. It’s clear that a bounded interval is a bounded set, so what we really need to prove is that every bounded interval is connected.
Suppose, then, that $X$ is a bounded interval; then there are $a,b\in\Bbb R$ such that $X$ is one of the four intervals $(a,b)$, $[a,b)$, $(a,b]$, and $[a,b]$. Note that in every case $(a,b)\subseteq X\subseteq[a,b]$. Now suppose that $x,y\in X$ with $x<y$; we want to show that $[x,y]\subseteq X$. If $x,y\in(a,b)$, then clearly $[x,y]\subseteq(a,b)\subseteq X$. If $x=a<y<b$, then $a\in X$, so $[a,b)\subseteq X$, and therefore $[x,y]=[a,y]\subseteq[a,b)\subseteq X$. If $a<x<y=b$, then $b\in X$, so $(a,b]\subseteq X$, and therefore $[x,y]=[x,b]\subseteq(a,b]\subseteq X$. And if $x=a$ and $y=b$, then $[x,y]=[a,b]=X$. In every case we find that $[x,y]\subseteq X$, so $X$ is connected.
Note: I have used the characterization of connectedness that you give at the beginning of your attempt. This is not the actual definition of connectedness, though it is equivalent for subsets of $\Bbb R$, and I am simply assuming that you already have it available to use here. If not, we would need to add a proof that it is equivalent to connectedness for subsets of $\Bbb R$.