'Ali's speech upon the death of Abu Bakr (ra)

Re: 'Ali's speech upon the death of Abu Bakr (ra)

Quran says in Sura Hasr verse 07 that "And whatsoever the Messenger gives you, take it; and whatsoever he forbids you, abstain (from it). And fear Allverily, Allis Severe in punishment."

Then in the begining of Sura Najm it is said that "Your Companion (The Holy Prophet) does not err, nor does he go astray. Nor does he speak out of desire. It is not but revelation that is revealed.

Every word of the Messenger is the revelation from the God as the Quran is saying. We find it impossible to believe that God did not prescribe a system to ensure the conservance of these very words that he is ordering us to follow which we refer to as hadees. I have read you say that the book is not enough without the hadees. Infact something as basic as namaz is not defined in the Quran. So in this case we can see that even the book of God is dependend on the Hadees. If its that important then why were the Muslims left to wonder around for 2 centuries after the Prophet before starting to realise and putting together the words of the messenger. What were the people following before the hadees was written?