The books of the Bible were formed gradually. They are the product of Jewish and Christian religious communities that was 95% illiterate. These stories were first word of mouth, then later put into writing. Moses did not write all the books of the Pentateuch. Paul did not write all the letters ascribed to him. Matthew and Luke partially rewrote Mark with other sources. There were additions and deletions, but we have what God wanted us to have.
The question of authorship or attribution is important. Like many of the books of the Old Testament, some of the books attributed to some authors in the New Testament writings are not the persons mentioned. Moses did not write all the Torah. Paul did not write all the letters attributed to him. The technical scholarly name for this is pseudo epigrams. Sometimes, they are forgeries. These false attributions exist for a number of biblical books. Since we do not know the names of many of the writers of these books in the Bible, we can say that anonymous people wrote these works. However, I have decided to use the traditional attributed names that have been associated with these pseudo epigram works to better identify them.