Trench Warfare
Big attacks didn't happen very often. An army could lose a quarter of a million men in a few days of heavy fighting. that could not be done very often - there just weren't enough men.
In between the big attacks soldiers of one side would sneak out at night into "No-Man's Land". There were several reasons for this:
To put up barbed wire.
To cut through the enemy barbed wire just before a big attack.
To spy on the enemy trenches.
To attack the enemy trenches.
To stop the enemy doing any of these things.

The most exciting and dangerous of these night time activities were
the Trench Raids. Small patrols of soldiers would sneak up to the enemy
trenches and launch a surprise attack. They might throw in hand-grenades
and then jump in to finish off the enemy with knives, iron bars, clubs
and spades. Rifles were not much good for this work as you didn't have
time to reload after the first shot. Often the aim of the attack
was to capture a prisoner who could then be questioned about what was happening
on his side.
Here is an extract from A.P. Herbert's war novel The Secret Battle, published in 1919. The author served as a soldier on the Western Front. In this extract plans are being laid for an attack on the enemy trenches.
There was a theory that this particular section of enemy trench hadbeen evacuated ... Harry was told to get right up to that trench, to look in, and see what was in it. It was a thing he had done twice before ... It meant the usual breathless, toilsome wriggle across No Man's Land, avoiding the flares and the two snipers who covered that bit of the ground, finding a gap in the wires, getting through without being seen, without noise, without catching his clothes on a wandering barb, or banging his revolver against a multitude of tin cans. Then you had to listen and wait and if possible look in the trench.
When (and io you had done that you had to get back ... past the same
obstacles, the same snipers.
However, Harry was a scout and it was his job.