What exactly is France supposed to do? Surrender and cede the captured territory to Germany? What happens the next time the Germans invade France?
It wasn’t like the generals were sitting around bored and just decided to order their men to charge the enemy trenches every so often. The previous posters who suggested that you wait, build up your forces until you have overwhelming superiority and artillery reserves and training, and only then attack? That’s what the generals were doing. It turns out that they were often wrong, but it wasn’t like they kept feeding in troops piecemeal.
The massive offensive that gets your army slaughtered is the one you launch when you think that this time you’ve got a decent shot at victory. Except you don’t know how the battle is going, and you can’t order your troops to retreat when things aren’t going well, because they’re advancing and out of communication. Even if it looks like disaster the most you can do is refuse to commit your reserves and abandon the attempt. Except maybe this time the enemy is close to breaking, and losing your nerve will just mean more of the same stalemate.
And note that one of the chief lessons of the war–that advance into prepared positions is suicide–was only true later in the war. During the initial German offensive through Belgium and France they regularly stomped past prepared fortresses and defensive lines, only to be stopped at the end of their strength a hair’s breadth from Paris. Waiting on the defensive for the enemy to attack you was a recipe for being flanked and cut off and destroyed.