The Earth retains an atmosphere because gravity pulls air particles toward the center of the Earth. Without something affecting the air —like gravity— air particles would move toward lower pressure, and Earth would lose its atmosphere.
Flat-Earthers claim that Earth should not be able to have an atmosphere because without any barrier separating Earth’s atmosphere and space, it would have been sucked by the vacuum in space. They are wrong. Gravity pulls air and allows Earth to retain an atmosphere.