The Genesis account of creation does not depict God creating matter out of nothing (what is traditionally called “creation ex nihlo”). Instead, Genesis narrates God creating this earth out of matter that already existed. The focus is not on the grander universe but only an account of this earth which serves as a backdrop for the covenant God will make with His people on this earth. Reading the Bible narrative from the perspective and worldview of the Bible writers can clarify our understanding and enhance our appreciation of scripture. Ultimately, and by so doing, we see more clearly the why of scripture: to teach us of the covenants of God.
https://ldsmag.com/preexistence-and-creation-a-perspective-on-how-to-read-the-creation-story/