It isn’t “Goodbye, Children” (1987).
I’m looking for a movie (probably French), the action takes place in a boarding school, 4 boys with names on “L” (Luis, Ludwig etc.) make a brotherhood pact, soon afterwards war breaks out, the school in their absence is evacuated, they wander around, a girl joins them, followed by a German deserter Hans (who dies) and then some more dark-skinned man who helps them. Ultimately, the kids escape by train from German soldiers (they were wearing pickelhaubes at the time), but instead of ending up somewhere in France, they wake up in Berlin in the morning.
The film was screened on the Renfe (AVE) train. It is French movie (probably).