ذَلِكَ بِأَنَّ اللّهَ نَزَّلَ الْكِتَابَ بِالْحَقِّ
...
That is because Allah has sent down the Book (the Qur'an) in truth.
means, they deserve this painful torment because Allah has revealed Books to His Messenger Muhammad, and the Prophets before him, and these revelations bring about truth and expose falsehood. Yet, they took Allah's signs for mockery. Their Books ordered them to announce the truth and to spread the knowledge, but instead, they defied the knowledge and rejected it.
This Final Messenger ـ Muhammad ـ called them to Allah, commanded them to work righteousness and forbade them from committing evil. Yet, they rejected, denied and defied him and hid the truth that they knew about him. They, thus, mocked the Ayat that Allah revealed to His Messengers, and this is why they deserved the torment and the punishment.
This is why Allah said here:
ذَلِكَ بِأَنَّ اللّهَ نَزَّلَ الْكِتَابَ بِالْحَقِّ وَإِنَّ الَّذِينَ اخْتَلَفُواْ فِي الْكِتَابِ لَفِي شِقَاقٍ بَعِيدٍ
That is because Allah has sent down the Book (the Qur'an) in truth. And verily, those who disputed about the Book are far away in opposition.