Consider the action
$$A_{1} = \int{L(q, \dot{q})}{dt}\tag{1}$$
and the corresponding Euler–Lagrange equation
$$\frac{\partial{L}}{\partial{q}} - \frac{d}{dt}\left(\frac{\partial{L}}{\partial{\dot{q}}}\right)=0.\tag{2}$$
This equation is a general condition that $L$ fulfill. Therefore this condition you can add to the original action as Lagrange multiplier (this change has no, in principle, affect for Euler–Lagrange equation).
$$A_{2} = \int{\left[L(q, \dot{q}) + \lambda\left(\frac{\partial{L}}{\partial{q}} - \frac{d}{dt}\left(\frac{\partial{L}}{\partial{\dot{q}}}\right)\right)\right]}dt\tag{3}$$
Where $\lambda \in R$ and so the last term is
$$\frac{d}{dt}\left(\lambda\frac{\partial{L}}{\partial{\dot{q}}}\right)\tag{4} $$
This term is in the form of total derivative and so we can dropped it from the lagrangian (generates the same equation). We're getting that expression
$$A_{2} = \int{\left(L(q, \dot{q}) + \lambda\frac{\partial{L}}{\partial{q}} \right)}dt\tag{5}$$
But this lagrangian generally generates a different equation than the original lagrangian $L$.
I can't figure out where I made a mistake.