An exercise concerning Borel measurability and continuity I am studying Folland's Real analysis and I am stuck at following exercise (not a homework).

Suppose that $f$ is a function on $\mathbb{R} \times \mathbb{R}^k$ such that $f(x,\cdot)$ is Borel measurable for each $x \in \mathbb{R}$ and $f(\cdot,y)$ is continuous for each $y \in \mathbb{R}^k$. For $n \in \mathbb{N}$, define $f_n$ as follows. For $i \in \mathbb{Z}$ let $a_i = i/n$, and for $a_i \leq x \leq a_{i+1}$ let,
  $$f_n(x,y) = \frac{f(a_{i+1},y)(x-a_i)-f(a_i,y)(x-a_{i+1})}{a_{i+1}-a_i}$$
  Then $f_n$ is Borel measurable on $\mathbb{R} \times \mathbb{R}^k$ and $f_n \to f$ pointwise; hence $f$ is Borel measurable on $\mathbb{R} \times \mathbb{R}^k$. Conclude by induction that every function on $\mathbb{R}^n$ that is continuous in each variable separately is Borel measurable.

Statement says $f_n$ is Borel measurable, by saying that it states it is Borel measurable for not only $f_n(x,\cdot)$ but also other variables of the function. I found this confusing.
Thanks in advance!
 A: We already discussed why $f_n$ is measurable on $\left[\frac in,\frac{i+1}n\right]\times \mathbb{R}^k$. For $(x,y) \in \left[\frac in,\frac{i+1}n\right] \times \mathbb{R}^k$ we have 
$$
f_n(x,y) = \frac{f\left(\frac{i+1}{n},y\right)\cdot\left(\vphantom{y}x-\frac in\right)-f\left(\frac in,y\right)\cdot\left(x-\frac{i+1}n\right)}{\frac1n}.
$$
In the numerator there is the difference of two products of measurable functions, hence it is measurable on $\left[\frac in,\frac{i+1}n\right]\times \mathbb{R}^n$. Using the partition $$\mathbb{R} \times \mathbb{R}^k = \bigcup_{i \in \mathbb{Z}} \left[\tfrac in,\tfrac{i+1}n\right]\times \mathbb{R}^k$$ one then sees that $f_n$ is measurable on all of $\mathbb{R} \times \mathbb{R}^k$.
To understand the definition of $f_n$, notice that for fixed $y \in \mathbb{R}^k$ the function $x \mapsto f_n(x,y)$ is continuous and it is linearly interpolating the values $f\left(\frac in,y\right)$ for $i \in \mathbb{Z}$: if $x = \frac{i}{n}$ then $f_n\left(\frac in,y\right) = f\left(\frac in,y\right)$. Once you observe this, pointwise convergence is not too hard to prove, using continuity of $x \mapsto f(x,y)$.

Concerning the induction in the last sentence of the exercise, suppose $n =2$ and that $f\colon \mathbb{R}^2 \to \mathbb{R}$ is continuous in each variable separately. Then $f \colon \mathbb{R} \times \mathbb{R} \to \mathbb{R}$ satisfies the hypothesis of the exercise (with $k=1$) and it follows that it is measurable. For the induction step, assume that for $n$ it is already proved that a function on $\mathbb{R}^n$ which is continuous in each variable is measurable. Now consider a function $f \colon \mathbb{R}^{n+1} \to \mathbb{R}$ which is continuous in each variable. Interpreting $f$ as a function $f \colon \mathbb{R} \times \mathbb{R}^n \to \mathbb{R}$, the induction hypothesis applies to $y \mapsto f(x,y)$ to show that it is Borel measurable and the exercise completes the induction step.
