Pivot[A_,k_,l_]:=Module[{B=A},
m=Dimensions[A][[1]];n=Dimensions[A][[2]];
For[i=1,i≤m,i++,
If[i==k,
B[[i]]=A[[i]]/A[[k,l]],
   B[[i]]=-A[[i,l]]/A[[k,l]]*A[[k]]+A[[i]]]
];
B
]

MatrixForm[A1={{1,2,1,0,0,8},{1,-2,0,1,0,4},{3,2,0,0,1,12},{-5,-4,0,0,0,0}}]

MatrixForm[A2=Pivot[A1,2,1]]