Variation on Lebesgue Number Lemma. Proof check. I would like to show the following: 
"Let $f$: $\mathbb{R}\to\mathbb{R}$ be a continuous function. Suppose that $K$ is a compact subset of $\mathbb{R}$, and $f(K)$ $\subseteq$ $\bigcup_{n=1}^{\infty} I_n$, where each $I_n$ is an open interval. Prove that there is a number $\delta > 0$ that for every $x \in K$, $(x - \delta, x + \delta)$ is contained in $f^{-1}(I_n)$ for some $n$."
After corrections:
Since $f$ is continuous on the open domain $\mathbb{R}$, then we know each $f^{-1}(I_n)$ is open. 
Now, for each $k \in K$, there is $\varepsilon_k > 0$ such that $(k - \varepsilon_k, k + \varepsilon_k) \subseteq f^{-1}(I_n)$ for some $n$.
Now, $K \subseteq \bigcup_{k \in K}(k - \varepsilon_k/2, k + \varepsilon_k/2)$. And since $K$ is compact, $K \subseteq \bigcup_{i=1}^{n}(k_i - \varepsilon_i/2, k_i + \varepsilon_i/2)$.
Set $\delta = \min\{\varepsilon_1/2, \dots, \varepsilon_n/2\}$.
Let $x \in K$. Then, $x \in (k_j - \varepsilon_j, k_j + \varepsilon_j)$ for some $j$.
Let $t \in (x - \delta, x + \delta)$. 
Then, $|t - k_j| \leq |t - x| + |x - k_j| \leq  \delta + \varepsilon_j/2 \leq \varepsilon_j/2 + \varepsilon_j/2 = \varepsilon_j$.
Thus, $t \in (k_j - \varepsilon_j, k_j + \varepsilon_j)$.
So, $(x - \delta, x + \delta) \subseteq (k_j - \varepsilon_j, k_j + \varepsilon_j) \subseteq f^{-1}(I_n)$
Therefore, there is a number $\delta > 0$ such that for every $x \in K$, $(x - \delta, x +\delta)$ is contained in $f^{-1}(I_n)$ for some $n$.
 A: Your main error is here:

So if $x\in f^{-1}[I_n]$, then for each $n=1,\dots,j$ there is an $\varepsilon_1,\dots,\varepsilon_j$ such that $$(x-\varepsilon_n,x+\varepsilon_n)\subseteq f^{-1}[I_n]\;.$$

Look at what you’ve actually said: if $x$ is in a particular $f^{-1}[I_n]$, then that same $x$ is in an open interval within each $f^{-1}[I_k]$ as $k$ runs from $1$ through $j$. You’re talking about a single fixed $n$ in the hypothesis of the sentence and about all of them at once in the conclusion. Moreover, this is a claim about a single fixed $x$; you very likely need different radii for other $x$’s. Thus, you cannot go on to conclude that these $\varepsilon_n$’s have anything to do with any other point of $K$.
HINT: Don’t try to work directly with the sets $f^{-1}[I_n]$. Instead, for each $x\in K$ find $\varepsilon_x>0$ such that $(x-\varepsilon_x,x+\varepsilon_x)$ is a subset of some $f^{-1}[I_n]$; it doesn’t matter which one. For each $x\in K$ let $$B(x)=\left(x-\frac{\varepsilon_x}2,x+\frac{\varepsilon_x}2\right)\;,$$ take a finite subcover of $\{B(x):x\in K\}$, and try to use that to get your $\delta$.
