“Every morning, a fearful monster called apep lurked beneath the place of sunrise, ready to swallow up the solar disk. This “Great Devil” was impossible to destroy, even for the Sun-god. However, by reciting morning after morning the powerful spell that Thoth provided him with, he could paralyze all of Apep’s limbs and rise upon this World.
Since the “great gods,” though benevolently inclined towards the dead, are unable to protect them from demons that lived upon “bodies, souls, spirits, shadows, and hearts of the dead,” the Egyptians decided to invoke Thoth’s assistance on behalf of their dead and to place them under the protection of his spells.
Many funerary texts were composed by Egyptian theologians under the fourth dynasty (about 3700 B.C.) and were probably well known under the first dynasty and throughout the whole Period of dynastic history; Thoth was thought to be the author of the “Book of the Dead.””
— The Ancient Egyptian Book of the Duat: The Book of the Dead, by Stacy Dalton