Why do you think it was so hard for armies to attack and win in World War I?
The reason for this is that military technology completely favored the defense at least until the very end of the war.
In previous wars, frontal assaults had at least been possible (though costly) because the attackers would be facing "only" rifle fire. The losses that would be suffered were seen as acceptable and such assaults could sometimes succeed (though not always, as seen in Pickett's Charge at Gettysburg).
By WWI, however, the machine gun had been invented. Machine guns had a tremendous rate of fire and were accurate at a longer range than rifles were. Because of this, frontal assaults in WWI were essentially suicidal. Attackers faced not only rifle fire, but machine gun fire as well.
It was only with the invention of tanks that defense lost its technological advantage, but this came very late in the war.