The First Compilation
The Qur’an was first compiled during the lifetime of Abu Bakr As-Siddiq (رضي الله عنه), the first khalifa, whose rule lasted from the death of the last messenger (صلى الله عليه و سلم) for two years.
Why wasn’t it compiled during the time of the Prophet (صلى الله عليه و سلم) himself?
On-Going Revelation: Revelation was still coming down. If you wrote two verses next to each other, and Allah revealed one in the middle–or an extension to the end of a surah–what then?