Here is the whole problem:

Calculus of Variations Rund Trautman Electromagnetism Problem
A,V,x and x dot are all functions of time.

I think I need to show that a function F exists such that

Now terms 2 and 4 are clearly only functions of t.

I can manipulate term 3 to get:

Now term 1 is my problem

And if I'm not mistaken I do that by getting rid of the partial derivaties?

Using the equation for E I get:

Now the RHS of this looks remarkibly (but not quite) like the total derivative of A. The next equation is not correct (I don't think) but it is the sort of thing I need to get to?