If I would like to shift the $x$ axis onto the line $a_1x+b_1y=0$ and the $y$ axes onto the line $a_2x+b_2y=0$ is the following operation correct?
$\begin{pmatrix} x ' \\ y' \\ \end{pmatrix} = \begin{pmatrix} a_1 & b_1 \\ a_2 & b_2 \\ \end{pmatrix} \times \begin{pmatrix} x \\ y \\ \end{pmatrix} = \begin{pmatrix} a_1x+b_1y \\ a_2x+b_2y \\ \end{pmatrix}$
is this correct?
Well, the origin is certainly mapped correctly. If you are on the $x$-axis, in other words $y=0$, your map results in $x(a_1,a_2)^T$ which is not what you would like. Ditto $x=0$, which results in $y(b_1,b_2)^T$, instead of being on the second line you specified.
Do you see how to change your transformation to make it work?