Hadiths were compiled and written down since the time of Prophet Muhammad (SallAllah-u-Alaihi-wa-Sallam), sahaba (RadiAllahu Tala Anhum) had their own scrolls or books, with the help of these scrolls and books other hadith books were compiled later onwards.
At first the Prophet (SallAllah-u-Alaihi-wa-Sallam) stopped his companions (RadiAllahu Tala Anhum) from writing down hadiths.
Whatever the reason, then afterwards this was permitted, there is a narration regarding it but it is dhaeef so we are not writing it.
Prophet of Allah (SallAllah-u-Alaihi-wa-Sallam) said to Abdullah bin Amr (RadiAllahu Tala Anho): Write hadiths, I swear by Him who holds my life in His hand, from this mouth nothing but the truth comes out.
[Abu Dawood, volume 1, pg 158: Sanad is Sahih]
Abdullah bin Amr (RadiAllahu Tala Anho) says: We were seated near prophet of Allah (SallAllah-u-Alaihi-wa-Sallam) and were writing, in this manner was asked: which city will be first conquered, Constinople or Rome?
He (SallAllah-u-Alaihi-wa-Sallam) said: Hercule’s city will be conquered first.
[Darmi, pg 126: Sanad is Sahih]
Prophet (SallAllah-u-Alaihi-wa-Sallam) said: Write this hadith and give it to Abu shah (RadiAllahu Tala Anho)….
[Sahih Bukhari & Sahih Muslim]
download link 1