The book of Genesis was not written by any one person named David, Samuel, or Abraham. It is generally believed to have been written by multiple authors over many centuries, with the final version being compiled and edited by the Israelites in the 5th century BCE.
The most widely held belief is that the book of Genesis was primarily written by Moses, who was a leader and prophet of the Israelites. According to the Bible, Moses received the stories and laws contained in Genesis directly from God and wrote them down as a record of the early history of humanity and the Israelites.
So, in summary, the book of Genesis is traditionally attributed to Moses, but it is likely the result of contributions from multiple authors over time.