If and only if proof dealing with a function that is uniformly continuous.
You have shown the reverse direction.
($\Leftarrow$) Clearly if $f$ has a uniformly continuous extension to all of $\mathbb{R}$, then it is uniformly continuous on the restriction to $(a,b)$.
($\Rightarrow$) Let $f$ be uniformly continuous on $I=(a,b)$. If $f$ has a uniformly continuous extension to $\overline{I}=[a,b]$, then we can further extend $f$ by defining $f(x) =f(a)$ for $x < a$ and $f(x) = f(b)$ for $x>b$. It is clear that this function is uniformly continuous on $\mathbb{R}$.
To show that $f$ has a uniformly continuous extension to the closure of $I$, choose a sequence $x_i \in I$ such that $x_i \to a$. Let $\epsilon>0$, and pick $\delta>0$ such that if $|x-y|< \delta$, then $|f(x)-f(y)| < \epsilon$. The sequence $x_i$ is Cauchy, hence there exists $N$ such that if $n,m > N$, we have $|x_n-x_m| < \delta$. Then we have $|f(x_n)-f(x_m)| < \epsilon$. Hence $f(x_i)$ is Cauchy and converges to some number $\phi$. To show that the limit does not depend on the sequence, suppose we have another sequence $x_i' \to a$. Since $x_i-x_i' \to 0$, uniform continuity shows that $f(x_i)-f(x_i') \to 0$, and hence $f(x_i') \to \phi$ also. So we can unambiguously define $f(a) = \phi$.
In a similar manner, we can extend $f$ to $b$.