Recently I have found myself repeating Shahadat again and again with the thought that what if due to some thought I had became a kafir although I have absolutely no doubt in Allah being the only God and in his oneness and and the Prophethood of Prophet Muhammad and the Wilayat of Imam Ali but still time to time I feel the need to repeat Shahadat even if any thought hadn’t crossed my mind

It’s good to repeat the Shahada. We repeat it in prayer. However you should ignore these thoughts.