When death approached him, he said, "I have kept something from you that I heard from the Messenger of Allah ﷺ. I heard the Messenger of Allah ﷺ say, 'Were it not that you commit sins, Allah would create a people who would sin so that He could forgive them.'"In another wording, "If you had no sins for Allah to forgive, Allah would bring forth a people who had sins, that He might forgive them."
حين حضرته الوفاة: كنت كتمت عنكم شيئا سمعته من رسول الله ﷺ، سمعت رسول الله ﷺ، يقول: لولا أنكم تذنبون لخلق الله خلقا يذنبون يغفر لهم وفي لفظ: لو أنكم لم تكن لكم ذنوب، يغفرها الله لكم، لجاء الله بقوم لهم ذنوب، يغفرها لهم.
Muslim narrated it in the Book of Repentance (2748:9) from Qutayba bin Saeed, who said, Layth narrated to us, from Muhammad bin Qays, the storyteller of Umar bin Abdul-Aziz, from Abu Sirma, from Abu Ayub, and he related it with the first wording. He also narrated it (2748:10) through the route of Muhammad bin Kaab Qurazi, from Abu Sirma, from him, and he related it with the second wording.