Did they use it to make the trench walls higher or for something else?
The dirt was used primarily in two ways. First, the initial dirt dug was used to build up the parapet along the front edge of the trench, which would have positions for rifleman to fire from at points along the top of the parapet. The parapet would require more dirt than might be expected, as to make earth bullet or shell proof it has to be compacted as much as possible. At the back end of the trench would be constructed the parados, a compacted dirt defense much like the parapet. Depending on the type of soil encountered, and the depth of the water table, it was often impossible to dig a trench down to a sufficient depth to effectively protect the soldiers. In these cases, much more dirt would have to be built up on both sides of the trench to provide sufficient cover.
The second use of dirt from the trenches would be to fill sandbags, which could then be used to strengthen the walls of trenches, bomb shelters, dugouts and the like. The work of expanding, reinforcing, and improving the trenches was a never ending one, and they would store the dirt in sandbags until it was required for repairing or reinforcing sectors of the trenches.
For more information than you ever wanted to know about trench construction, check out the manual "Trench Warfare, a Manual for Officers and Men" by Second Lieutenant Joseph Smith of the BEF, circa 1917. It is pretty comprehensive, and an interesting read. https://archive.org/details/trenchwarfareman00smitrich