Dear student,
The vapours of the fuel lies in the air surrounding the car when the petrol tanks are filled. When the engine of the car is kept on, heat is created which when comes in contact with the vapours of the fuel, can cause ignition and accident can take place, Hence, car engine should be switched off.
Regards