Nice thing about the engineer is that there are builds that can work well for back line and front line play in zergs. However, as East pointed out, the general consensus is that engineers perform subpar in each of these roles. Engineer utility in a zerg boils down to might stacking, condi removal + water field (with healing turret), and possibly cc if you are running a front line build.
Typical grenadier build
Traits: 6/x/x/x/x Obviously, Explosives is the core of this build. Distribution of the rest of the traits is really up to you. If you want consistent boosts in damage, target the weak (Firearms) and scope (Tools) can potentially boost your crit chance by 20% (10% if enemies are above the 50% health threshold. Enduring damage (Tools) can increase your damage by 10% while you have full endurance. Target the maimed and modified ammo (Firearms) can also boost your damage but I don’t consider them to be reliable since they are procced by conditions. Some players like to put 6 into Alchemy for survivability in the case that the front line is broken and you find yourself in the heat of battle.
Gear: If you are experienced you should be able to get guild wars 2 gold with running berserker gear. Otherwise, mixes of zerker with cele, knight’s, or other power oriented gear work well too. Do Not run condition builds for zerging since condis will be quickly removed in zergs. For weapons, p/s is the superior option (mainly for the shield’s utility) since you really wouldn’t be using your main weapon anyway.
Utility slots: grenade kit (obviously), healing turret for heal skill, and either elixir gun (leap, condi removal, stunbreaker), tool kit (block, pull), or bomb kit (if you intend to stack your own might). The elixirs are also fair choices.
Things to note: pay close attention to retaliation on enemy zergs. You could potentially down yourself from your own nade throws alone. Use your nades intelligently.
Can’t recommend using flamethrower in wvw zergs since its damage is relatively low and you will run into the same issue with retaliation. Bombs are the superior option for running in the front line.