What is Ruqyah and how should one do it? (website)
It is obvious that you are letting wiswas control your life. You don’t remember it because it wasn’t there. Allah told us in the Quran that the righteous people when they are touched by the wiswas of Satan, they remember Allah and then they are able to see clearly. You should do that. You must not write things to remind you of Kufr as this is one of Satan’s ways to make you believe that this is happening. Ignore these ideas and don’t give them any weight and they will go away by themselves, in sha’ Allah.
And Allah knows best
If this is an OCD and doctors say that this is an illness, there is nothing for you to do as you are sick. No one in his right mind and Islam would dare and do such a thing even if he claims he didn’t intend it.