Thanks for your answer, K^2!
Now that I'm looking at my post again I realize I didn't formulate it properly. Speaking about time derivative of function F, which, when added to Langrangian, does not change the equations of motion, I should have written
In such case
will vanish when variating the Lagrangian (because time instants and position of the both ends of trajectory are fixed).
In such case the endpoint velocity does not matter. Each Lagrangian constructed this way is equivalent (results in the same equations of motion and trajectory). When deriving the conservation laws, why do we assume that translation does not change the Lagrangian at all, then? I intuitively feel that this might have something to do with the freedom of choosing the inertial frame, but my intuition is not trained yet, so just a guess.