Some of this material left the solar system altogether. A large impact may have provided additional heat for melting as well as ejecting enough material to become the moon. Additional heat for melting was formed from radioactive decay which continues to this day. A molten Earth could further differentiate with heavier materials sinking. Gases would have escaped from the inner part of the planet and if they did not escape would have formed the early atmosphere.
Gases continue to escape from the interior as volcanic emissions.
Eventually some material would have become so light that it floated and formed proto-continents. Continued volcanic eruptions accompanied by weathering - the breakdown of rocks into littler pieces eventually formed continents. Internal emissions would have been intense in the early years and although many of the gases escaped the Earth completely, enough remained to form an atmosphere. Comets may have brought additional material such as water, carbon dioxide, and other elements. The other inner planets either do not have atmospheres or they are very different.