In fact, this method not only helps to improve morale and relieve pressure, but also reminds machine gun positions to pay attention to their positions and prevent machine gunners from accidentally injuring themselves. This role may only be understood between the machine gunner and the infantry.
In actual combat, if there is enough time, the machine gunner will also set up an extremely detailed shooting table to ensure that the shooting time and shooting position avoid friendly forces, so the possibility of accidentally injuring his own infantry is very low.
However, there are also examples of accidental injuries on the battlefield. I remember that in the Iraq war, a British soldier was accidentally injured by his opponent. After all, none of these propaganda can be useful.