وَلَقَدْ اتَيْنَا مُوسَى الْكِتَابَ فَاخْتُلِفَ فِيهِ
Indeed, We gave the Book to Musa, but differences arose therein,
Allah mentions that He gave Musa the Book, but the people differed concerning it. Some believed in it and some disbelieved in it. Therefore, you, Muhammad, have an example in the Prophets who came before you. So do not grieve or be upset by their denial of you.
وَلَوْلَا كَلِمَةٌ سَبَقَتْ مِن رَّبِّكَ لَقُضِيَ بَيْنَهُمْ
and had it not been for a Word (Kalimah) that had gone forth before from your Lord, the case would have been judged between them,
Ibn Jarir said,
"If it were not that the punishment had already been delayed until an appointed time, then Allah would have decided the matter between you now.
The word Kalimah carries the meaning that Allah will not punish anyone until the proof has been established against him and a Messenger has been sent to him."
This is similar to Allah's statement,
وَمَا كُنَّا مُعَذِّبِينَ حَتَّى نَبْعَثَ رَسُولاً
And We never punish until We have sent a Messenger (to give warning). (17;15)
For verily, Allah says in other verse,
وَلَوْلَا كَلِمَةٌ سَبَقَتْ مِن رَّبِّكَ لَكَانَ لِزَاماً وَأَجَلٌ مُّسَمًّى
فَاصْبِرْ عَلَى مَا يَقُولُونَ
And had it not been for a Word that went forth before from your Lord, and a term determined, (their punishment) must necessarily have come (in this world). So bear patiently what they say. (20;129-130)
وَإِنَّهُمْ لَفِي شَكٍّ مِّنْهُ مُرِيبٍ
and indeed they are in grave doubt concerning it (this Qur'an).
Then, Allah informs that He will gather the early generations and the later generations from all of the nations. He will then reward them based upon their deeds. If they did good deeds, their reward will be good, and if they did evil deeds, their reward will be bad.
Allah says,
وَإِنَّ كُـلًّ لَّمَّا لَيُوَفِّيَنَّهُمْ رَبُّكَ أَعْمَالَهُمْ
إِنَّهُ بِمَا يَعْمَلُونَ خَبِيرٌ