All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, is His slave and Messenger.
What you are imagining of being afflicted with a Jinn possession, magic, or the like might be mere illusion that is far from being true, but it might also be true. Anyway, reciting the Ruqyah (healing through Quranic recitation, supplication and Thikr [expressions of remembrance of Allah]) is beneficial, Allah willing, for healing all illnesses. As you hold onto the power of strong faith, put your trust in Allah, be true to Him, and resort to Him for help, He will bless you with recovery from your condition. Once you are blessed with recovery from this illness, you should thank Allah by adhering to His Sharee‘ah, striving to obey Him, and staying away from sins and misdeeds. You may experience stronger or weaker sinful urges afterwards, yet your recovery from this illness has no effect in this regard as far as we know. However, it is incumbent on you, in all cases, to strive in restraining your lusts and committing yourself to obeying Allah, The Exalted, and devoting yourself to Him.
Allah knows best.