Prob. 19, Chap. 4 in Baby Rudin: Any real function on $\mathbb{R}$ whit the intermediate-value property for which ... is continuous Here is Prob. 19, Chap. 4 in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition: 

Suppose $f$ is a real function with domain $\mathbb{R}^1$ which has the intermediate value property: If $f(a) < c < f(b)$, then $f(x) = c$ for some $x$ between $a$ and $b$. 
Suppose also, for every rational $r$, that the set of all $x$ with $f(x) = r$ is closed. 
Prove that $f$ is continuous. 
Hint: If $x_n \to x_0$ but $f\left( x_n \right) > r > f(x_0)$ for some $r$ and all $n$, then $f \left( t_n \right) = r$ for some $t_n$ between $x_0$ and $x_n$; thus $t_n \to x_0$. Find a contradiction. (N. J. Fine, Amer. Math. Monthly, vol. 73, 1966, p. 782.)

My effort: 

Suppose $f$ satisfies the hypotheses in Prob. 19, Chap. 4 in Baby Rudin, but $f$ fails to be continuous at a point $p \in \mathbb{R}$. Then there is a sequence $x_n$ of real numbers such that $$x_n \to p, \ \mbox{ but } \  f\left( x_n \right) \not\to f(p) \ \mbox{ as } \  n \to \infty.$$ Thus, there is a positive real number $\varepsilon_0$ such that, for every natural number $N$, there is a natural number $n_N > N$ such that $$f\left( x_{n_N} \right) \not\in \left( \ f(p)-\varepsilon_0, \ f(p) + \varepsilon_0 \ \right).$$
  Therefore there is a subsequence $\left\{ y_n \right\}$ of $\left\{ x_n \right\}$ the images $f\left( y_n \right)$ of each of whose terms are outside the segment $\left( \ f(p)-\varepsilon_0, \ f(p) + \varepsilon_0 \ \right)$.
So there is a subsequence $\left\{ z_n \right\}$ of $\left\{ y_n \right\}$ such that
  $$f\left( z_n \right) \leq  \ f(p)-\varepsilon_0 \ \mbox{ for all } \ n \in \mathbb{N}$$ 
  or
  $$ f \left( z_n \right) \geq  \ f(p)+\varepsilon_0 \ \mbox{ for all } \ n \in \mathbb{N}.$$ 
  Let's assume, without any loss of generality, that 
  $$ f \left( z_n \right) \geq  \ f(p)+\varepsilon_0 \ \mbox{ for all } \ n \in \mathbb{N}.$$ 
  Let $r$ be a rational number such that $$ f(p) < r < f(p) + \varepsilon_0. \ \tag{1} $$ 
  Then we see that 
  $$f\left( z_n \right) > r > f(p) \ \mbox{ for all } n \in \mathbb{N}.$$
  Now as $\left\{ x_n \right\}$ converges to $p$, so $\left\{ z_n \right\}$ also converges to $p$. 
Now as $f$ satisfies the intermediate value property, so, for each $n \in \mathbb{N}$, there is a point $t_n$ between $z_n$ and $p$ such that $$ f\left( t_n \right) = r. $$ 
  Then the sequence $\left\{ t_n \right\}$ must also converge to $p$. 
But $\left\{ t_n \right\}$ is a sequence in the closed set $$ f^{-1} \left( \{ r \} \right) = \left\{ \ x \in \mathbb{R} \ \colon \ f(x) = r \ \right\}.$$
  So the point $p$ must also belong to this set, which implies that $f(p) = r$, which contradicts (1) above. 
Hence any function $f$ which satisfies the all of the hypotheses of Prob. 19, Chap. 4 in Baby Rudin, 3rd edition, must also be continuous on all of $\mathbb{R}^1$. 

Is my proof correct? If so, have I correctly used the hint given by Rudin? If not, then where have I gone wrong? 

Your proof looks fine, and I would agree it's the approach that Rudin was suggesting.
The one suggestion I would make is to explain why the sequence $\{t_n\}$ converges to $p$.
