The Epics of Gilgamesh and Atrahasis are two near Eastern works (specifically Sumerian) considered being some of the oldest in the known world. Atrahasis, written in poetic form, describes the story of the creation; that is how and why man was made. The reason for the creation of man was that the gods needed someone to do their work for them, as the junior gods had neglected their duties. Thus, when man was made, the essence of his being created was to pick up where the junior gods had left off and to continue with providing for the gods and themselves.
Atrahasis is also the story of the King Atrahasis of Shuruppak who was instructed to build a boat to house his family and pairs of all kinds of animals when the gods initiated a flood that killed all the remaining living beings.