I heard in a majlis that an Imam said that if someone is praying namaaz consistently and sees that they are not moving away from gunnah, it means their namaaz is not qabool. Unfortunately I cannot find the exact quote or the Imam that said it. Could you please confirm if there is a hadith like this and if its true?

The purpose of Namaaz is to soften our hearts and make us better human being.

Quran 29:45 makes it clear that stops us from committing sins.

“CONVEY [unto others] whatever of this divine writ has been revealed unto thee, and be constant in prayer: for, behold, prayer restrains [man] from loathsome deeds and from all that runs counter to reason; and remembrance of God is indeed the greatest [good]. And God knows all that you do”

What you heard from the Maulana is true.