In Suicide Squad (2016), Amanda Waller's helicopter shot some fireworks after take-off.
What is the purpose of it?
Those aren't fireworks.....they're flares used to decoy heat-seaking missiles.
There had already been one helicopter downed by a missile. They were just taking precautions.
A flare or decoy flare is an aerial infrared countermeasure used by a plane or helicopter to counter an infrared homing ("heat-seeking") surface-to-air missile or air-to-air missile. Flares are commonly composed of a pyrotechnic composition based on magnesium or another hot-burning metal, with burning temperature equal to or hotter than engine exhaust. The aim is to make the infrared-guided missile seek out the heat signature from the flare rather than the aircraft's engines.