So you know that Moses who wrote some of the books of the Bible and other people also wrote books. How did they know what God wanted and what He didn’t want? Or did God really have a voice that reached from the heavens to earth and told them what to write back then?
It appears you think of God as being solely in heaven and separated from the life here on earth. "'Can a man hide himself in hiding places so I do not see him?' declares the LORD. 'Do I not fill the heavens and the earth?' declares the LORD" (Jeremiah 23:24). We speak of God's presence in the universe and we say that He is omnipresent; that is, He can be felt anywhere. "Where can I go from Your Spirit? Or where can I flee from Your presence? If I ascend to heaven, You are there; if I make my bed in Sheol, behold, You are there. If I take the wings of the dawn, If I dwell in the remotest part of the sea, even there Your hand will lead me, And Your right hand will lay hold of me. If I say, "Surely the darkness will overwhelm me, and the light around me will be night," Even the darkness is not dark to You, and the night is as bright as the day. Darkness and light are alike to You" (Psalms 13:7-12). Therefore, the idea that God can speak His thought into a person's mind should not be surprising.
How God told the people what to say varied greatly, especially during the time before the New Testament. In Hebrews 1:1-2, the writer said that God spoke at different times and in different ways in the past. Sometimes he spoke to people in dreams, such as in Genesis 20:3. At other times he gave people a special dream that represented what they needed to know, such as in Genesis 37:5-10. God also used visions. A vision is seeing something that is not physically there. It would be sort of like a waking dream. An example of this can be found in Genesis 15:1. Sometimes God would send an angel to deliver his message, such as in Matthew 1:18-24. Another method that God used was prophets. A prophet was a spokesman for God. God would deliver a message to the prophet and the prophet would then deliver the message to the proper person. Moses was a prophet, but he held a special place. God did not use cryptic dreams with him or using sayings that were difficult to understand. God spoke plainly and directly with Moses just as a person would speak to his friend. (Numbers 12:6-8.)
In II Timothy 3:16, Paul said that all Scripture is God-breathed (or inspired, depending on your translation). By this, Paul means that our entire Bible comes from the mouth of God. God told the various writers what to say and they then told the people and wrote the words down. Paul also told us that God gave the very words to record. "Now we have received, not the spirit of the world, but the Spirit who is from God, so that we may know the things freely given to us by God, which things we also speak, not in words taught by human wisdom, but in those taught by the Spirit, combining spiritual thoughts with spiritual words" (I Corinthians 2:12-13). Therefore, we are not talking about prophets receiving vague feelings or being told roughly what to say and then they wrote it down in their own words. God made sure that the prophets recorded exactly what He wanted to be recorded.