Dear questioner,
Thank you for your important question.
May Allah, Most High, reward you for your desire to increase in knowledge.
This practice is valid. When a Muslim recites the testimony of faith (shahada), it is an act of worship. It is not just recited due to fear of polytheism. A ruling of polytheism is only applied upon an action done with the knowledge of it being a polytheistic action.
Reciting the testimony of faith (shahada) is a righteous form of remembrance. The scholars mention that its repetition has many virtues. Among them are;
A pure admittance and emphasis of the Shahada.
A renewal of belief and certainty
A removal of ignorance
(Ibn Allan, Futuhaat ar-Rabbaniya)
The Shahada may be recited at any time.
And Allah alone knows best,
[Ustadh] Omar Popal
Checked and Approved by Shaykh Faraz Rabbani