Peace be on you.
Allah wants soul of people progress after they leave this mortal world. But if some people lack essential purity in Hereafter. They will be sent to workshop, corrective place, etc where they shall get some treatment then they shall be like newly born, they will be out to start spiritual progress. .....That corrective place is called Jahanum / Hell in Islam. According to Ahmadiyya Muslims, it will be difficult place but still temporary.
The Holy Quran does not teach that those in hell shall suffer everlasting torments.
Hell is meant for the advancement of weak human and their purification. There is no doubt that the abiding of evil-doers in hell is mentioned in some verses of the Holy Quran to be for "
abad " which sometimes means prospective eternity, but "
abad" also signifies a long time. And there are numerous passages in the Holy Quran showing that those in hell shall ultimately be taken out. Thus, in ch. 6: v. 129, the Quran says: "God said, Verily the fire is your resort to dwell therein unless thy Lord will it otherwise, verily, thy Lord is wise and knowing." On another occasion, those in hell are spoken of as "staying therein for years" (ch. 78: v. 23). The original word is "
Ahqab" which is the plural of "
huqub", meaning a year or years, or seventy or eighty years, or a long time (see Lanes Arabic Lexicon).
Ref:
https://www.alislam.org/library/links/00000017.html
Moreover:
[ch101:v10] "Hell will be his (nursing) mother."
The words are "fa ummohu haviah"
So Hell has a purpose and it is to make weak soul to be able to get spiritual progresses.