I need to prove
$f(x,y)$ is irreducible in $k[x,y]$ $\implies$ $f(x,y)$ is irreducible in $k(y)[x]$.
The book starts by assuming $f(x,y)$ to be reducible in $k(y)[x]$ and I worked out as following: $$f(x,y)=\left(\frac{a_n}{b_n}x^n + \frac{a_{n-1}}{b_{n-1}}x^{n-1} +\dots+\frac{a_0}{b_0}\right)\left(\frac{a'_n}{b'_n}x^n + \frac{a'_{n-1}}{b'_{n-1}}x^{n-1} +\dots+\frac{a'_0}{b'_0}\right)$$ where $a_i, b_i,a'_i,b'_i\in k(y).$
Now to get contradicton we start by multiplying by $b_1b_2...b_nb'_1b'_2...b'_m$ ,we will obtain a factorization of $b_1b_2...b_nb'_1b'_2...b'_mf(x,y)$ not of $f(x,y)$ in $k[x,y]$. I need help here.
This basically follows from Gauss' lemma. In a more general settings, let $R$ be unique factorization domain and $K$ its field of fractions (in your case $R=k[y]$ and $K=k(y)$). Suppose that a polynomial $f(x)\in R[x]$ factorizes in $K[x]$ to $f(x)=h(x)g(x)$. Find $r_1,r_2\in R$ such that $r_1h(x),r_2g(x)\in R[x]$ to get the equation $r_1r_2f(x) = (r_1 h(x)) (r_2 g(x))$ with polynomials in $R[x]$. If $p$ is an irreducible element in $R$ which divides $r_1r_2$, then it divides $(r_1 h(x)) (r_2 g(x))$ and therefore divides one of them (in $R[x]$!).
After dividing by $p$ you get a new equation in $R[x]$, wlog $\frac{r_1r_2}{p}f(x) = (\frac{r_1 h(x)}{p}) (r_2 g(x))$. Now repeat this process for each irreducible that divides $r_1r_2$ to get your required result.
Just to give an intuition to what happened here, consider the example $x^2+x=\frac{x+1}{2} \cdot 2x$ which is a decomposition over $\mathbb{Q}[x]$ which is almost a decomposition over $\mathbb{Z}[x]$ - you just need to move the 2 from one factor to the other.