The story in chapter 1 and the story in chapter 2 are two different stories and happened billions if not trillions or more years in our time apart.
Most Hebrew Scholars agree that they are two different stories they just have different ways of explaining what they believe about them.
The Bible is very plain. The heavens and the earth began to exist in Genesis 1:1 Since the verb bara is in the 3rd person perfect it means that the action of God was completed and the heavens and the earth existed.
We know they did because in verse 2 they were in a mess.
Geneses 2:4 declares that it is the beginning of the history of the day in which God created the heavens and the earth. So everything that took place in chapter 2 of Genesis took place in the same light period in which the heavens and the earth began to exist.
I determined the day the heavens and the earth began to exist as a light period, because of God's definition of a light period as a day in Genesis 1:5. This light period in which the heavens and earth began to exist had ended prior to Genesis 1:2 as darkness was over the face of the earth.
Genesis 2:4 plainly says day and not night. So God created the heavens and the earth in a light period.
A light period is always followed by the evening, preceding the dark period that follows a light period.
Now as far as Moses writing the Torah. Moses spent a total of 80 days in the Mount with God. I will make an assumption here that God was explaining how things happened in the beginning and up until God was visiting with him on the Mount. I don't think they were playing checkers or some other game. When Moses was ready to come down from the Mount after the second 40 days God told him to write all the things he had heard. He told Moses that several times in the book of Exodus.
God Bless,
"John 5:39 (KJS) Search the scriptures; for in them ye think ye have eternal life: and they are they which testify of me."