I also found an interesting answer on how could the writer of Genesis 1 could thought that there was light, day and night in the first creative day without creating the sun and the stars (knowing that these were created in the fourth day). So here I quote what I found:
The view of light and darkness as physical entities that cause day and night can be found in at least one ANE text as well. In a fragmentary Sumerian tablet (NBC 11108) from Nippur during the Ur III period (21st cent. BCE), we find the following:
When Anu, the lord, made heaven shine, made earth dark… Heaven and earth he held together as one… Day did not shine; in night, heaven stretched forth. Earth, bringing forth plant life did not glow on its own…[11]
The text describes the Sumerian high god Anu’s creation of the world. When Anu separates heaven and earth, the heavens shine but the earth does not. In other words, when the heavens and earth were combined in the primordial mush, there was perpetual night. By separating the heavens from the earth, Anu also separates light from darkness.
Wayne Horowitz notes the parallel with Genesis:
In NBC 11108:8, as in Genesis, where day exists before the creation of the sun, moon, and stars, the heavens are conceived to have had their own glow, irrespective of the presence of luminaries. [12]