How did the gentlemen who gathered together to write the Bible do so? Where did their information come from? The holy Bible is beautifully written. When was it written? How did they know all the details?
Ultimately, God inspired them to convey the unique divine self-revelation that we find in the Bible. We need to accept the Bible on its own terms. We may mistakenly think of it as entirely eyewitness accounts in which the biblical writers act like court reporters, giving us a verbatim account. Although most biblical writers do not claim to be eyewitnesses to the events described, the Jewish people and later the Christians recognize these writings as inspired by God.
If biblical writers were giving verbatim accounts, why does the Book of Genesis open with two very different accounts of creation: the Priestly account (1:1—2:4a) and the Yahwist account (2:4b—4:26)? Why do the oldest books of the Old Testament deny that there is a life after this one while some of its newest books are open to that idea? Why did some New Testament writers expect Jesus to return imminently and others did not? Also, your question assumes that the biblical writers were all men, but that might not be true.
The Old Testament books were written over a period of 1,700 years (from the time of Moses to shortly before the birth of Jesus), and the New Testament books were completed in approximately 75 years.
If you could gather all the biblical writers in one place, and if they all spoke the same language, you might witness some rather heated debates. The Bible is indeed a wonderful collection of books, but we must accept it on its own terms without imposing our expectations on it.
For example, because Tatian in the middle of the second century was bothered by different Gospel accounts, he tried to homogenize them into a single text called the Diatessaron rather than admit that God could and did inspire four Gospels with different details in places but identical in affirming Jesus Christ as God’s best self-revelation.