Praise be to Allah.
If a person is a wrongdoer who has no purpose in life, he should strive first of all to repent sincerely to Allah , and change his ways from wrongdoing and sin to justice and obedience to Allah.
With regard to the answer to what you asked about, if he follows a scholar who says that i‘tikaaf is only valid in the three mosques, there is nothing wrong with him staying in the mosque during the last ten nights of Ramadan. This applies even if it is not i‘tikaaf, according to his belief; staying in the mosque for the purpose of prayer, dhikr, reading Qur’an and waiting for the prayer is a virtuous deed in and of itself. The Prophet (blessings and peace of Allah be upon him) said: “If he prays (i.e., in the mosque), the angels will continue to send blessings upon him so long as he remains in the place where he prayed, (saying): ‘O Allah send blessings upon him, O Allah have mercy upon him.’ And one of you remains in a state of prayer so long as he is waiting for the prayer.”
Narrated by al-Bukhaari (648) and Muslim (649).
Al-Bayhaqi narrated in Shu‘ab al-Eemaan (2943) that ‘Amr ibn Maymoon al-Awdi said: The companions of the Messenger of Allah (blessings and peace of Allah be upon him) told us that the mosques are the houses of Allah on earth, and it is incumbent upon Allah to honour those who visit Him in them. Classed as saheeh by al-Albaani in Silsilat al-Ahaadeeth as-Saheehah (1169).
In addition to that, it also has the benefit of allowing one to focus on worshipping Allah, may He be exalted, and to leave behind worldly matters that may distract one.
And Allah knows best.