So I better do this for all variables xp2, xe1, xe2 and then it´s fine and I can add up the equations. This should work, I will do so. On the other hand I tried to calculate the equation for two more variables and it´s messed up again. Why can´t one justelongate the equation and fine? I don´t get it. Here is what I have done:
L[t_, xp1_, xp1prime_, xp2_, xp2prime_] = 1/2 (mp1*xp1prime^2 + mp2*xp2prime^2) - 1/2 k (xp1 - xp2)^2 + 2 me1Le1 (xp1 - Cos[xe1[t]]) xp1prime*xe1'[t] + me1Le1*xe1'[t]^2 + 1/2 ((2 me2Le2xe2 - Cos[xe2[t]]) x2'[t] xe2'[t] + me2Le2^2 xe2'[t]^2);
lagEq = D[ D[L[t, xp1, xp1prime, xp2, xp2prime], xp1prime, xp2prime] /. {xp1 -> xp1[t], xp1prime -> xp1'[t], xp2 -> xp2[t],
xp2prime -> xp2'[t]}, t] - (D[L[t, xp1, xp1prime, xp2, xp2prime], xp1, xp2] /. {xp1 -> xp1[t], xp1prime -> xp1'[t], xp2 -> xp2[t],
xp2prime -> xp2'[t]}) == 0
DSolveValue[lagEq /. {xe1 -> Identity, xe2 -> Identity}, xp1[t], xp2[t], t]