The apostles were very clear that what was written was what God wanted written. For example, Exodus 33:11 says that God spoke to Moses “face to face” as a man speaks to his friend. Moses wrote down many things that God told him personally (Exodus 24:4, Deuteronomy 31:9). All of the prophets were moved by the Holy Spirit to write down their messages. 2 Peter 1:20-21 says, “Above all, you must understand that no prophecy of Scripture came about by the prophet's own interpretation of things. For prophecy never had its origin in the human will, but prophets, though human, spoke from God as they were carried along by the Holy Spirit.”
Some people might ask why the books show the distinctive personalities of their writers. One way to think about this is to use the analogy of a master musician, who can play a piano, a violin, a guitar, a flute, etc. Each instrument has its own distinct sound, but it is the same musician who is playing. Similarly, the prophets can be likened to different instruments. God spoke through individual prophets. Their messages have unique characteristics, but it is the same Master Writer speaking through them all.