Earth generates tremendous amounts of heat internally. It is largely composed of a very hot liquid magma beneath a thin crust. Magma (lava) spews forth anywhere the crust is thin enough to permit it.
That is true but in outer space, with no sun to heat it, that wouldn’t be enough to keep the atmosphere from freezing.