Hyundai Elantra eco 2013 stalls and restarts without any proplem

My Hyundai Elantra eco 2013 model started developing this problem of stalling in motion and when you start it starts with out any problem but will stall again and again, this started after i changed the top gasket due to over heating, but the car never over hearts again but keeps stalling on motion without error code

Please read this: https://www.carcomplaints.com/Hyundai/Elantra/2013/engine/stalls_while_driving.shtml

There’s a bevy of ECM updates available for this car. Make sure the dealership has already installed all of them for you. I don’t see that any of them address stalling while driving directly, but before you assume it is something else at least make sure you have the full complement of known software fixes going for you. Ask for a copy of the complete list of the Recalls, Customer Interest, and Technical Support Bulletins that have been issued for your vehicle as a reference.

That said, for engine-stalling while driving, ignition switch problems are a common cause. Dangling keys swinging around as you go over bumps, around corners can turn the engine off on faulty switches. Try driving with just the one key in the ignition, no other keys or key chain. If that seems to improve the situation or solves it, then you need a replacement ignition switch.