You started out ok, but your second line is incorrect.
This part is right 4(3xy^2+1)^3. Now you must multiply by the derivative of the inside function.
So d/dx (3xy^2+1)= 6xy(dy/dx)+3y^2.
Putting the LHS together it's 4(3xy^2+1)^3 * (6xy(dy/dx)+3y^2)
The RHS of your work is correct.