How did the Bible come into being?

In the beginning of the Church, there were no sacred writing concerning Jesus and the truth he proclaimed. Some Apostles of Jesus and other Christians, prompted by different reasons, decided to write down what they considered important to be known by Christians.

"In the one-hundred-year period extending roughly from 50 to 150, a number of documents began to circulate among the churches, including epistles, gospels, memoirs, apocalypses, homilies, and collections of teachings. While some of these documents were apostolic in origin, others drew upon the tradition the apostles and ministers of the word had utilized in their individual missions. Still others represented a summation of the teaching entrusted to a particular church center. Several of these writings sought to extend, interpret, and apply apostolic teaching to meet the needs of Christians in a given locality." (Wikipedia/Development of the Testament canon)

Who would decide which writing were inspired and which were not?

The Council of Laodicea, c. 360 AD produced a list of books similar to what we have today.
Pope Damasus, 366-384 AD
in a decree listed the books of today's canon.
The Councils of Hippo in 393 and Council of Cartage 397 and 419 AD (North Africa local Councils) created the same list of Biblical writings Catholics use today.
The Council of Florence 1441 AD produced the first definitive list or Canon of the Bible. (catholicapologetics.org/The Canon of the Bible)

"In the 16th century, Martin Luther adopted the Jewish list, putting the Deuterocanonical books in an appendix. He also put the letter of James, the letter to the Hebrews, the letters of John, and the book of Revelation from the New Testament in an appendix. He did this for doctrinal reasons (for example: 2 Maccabees 12:43-46 supports the doctrine of purgatory, Hebrews supports the existence of the priesthood, and James 2:24 supports the Catholic doctrine on merit). Later Lutherans followed Luther’s Old Testament list and rejected the Deuterocanonical books, but they did not follow his rejection of the New Testament books." (ewtm.com/Faith) This prompted a reaction by the Catholic Church, the Council of Trent in 1556 which infallibly declared the list of Canonical Books of the Bible.

In conclusion: It is Christ who said that he had many more things to tell us later through the Holy Spirit, the Spirit of Truth. (Jn 16"12-13) "All Christians realize that if God has revealed Himself by communicating His will to man, man must be able to know with assurance where that revelation lies. Hence the need for a list (i.e. canon) of books of the Bible. In other words, man needs to know without error (i.e. infallibly) what the books of the Bible are. There must be an authority which will make that decision." ... "The Bible is the book of the Church; she is not the Church of the Bible. It was the Church--her guided by the authority of the Spirit of Truth which discovered the books inspired by God in their writing. The church did not create the canon; she discerned the canon. Fixed canons of the Old and New Testaments, hence the Bible, ...." (Ibid., The Canon of the Bible)

10. The Living Church Is the Source of Faith