All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
Athkaar (plural of Thikr, i.e. remembrance of Allaah) of sleeping have been mentioned in many authentic Ahaadeeth that were explained in the books of Sunnah and the books that were written regarding Athkaar in particular such as Al-Athkaar by An-Nawawi, Al-Kalim At-Tayyib by Ibn Taymiyyah, and Al-Waabil As-Sayyib by Ibn Al-Qayyim. Indeed, such supplications are sufficient for the Muslim individual.
As for the Thikr mentioned in the question, we did not find any basis for it in the available books of the Muslim scholars. Muhammad ‘Abdussalaam Khidr Al-Shuqayri denied it in his book As-Sunan wal Mubtada‘aat, where he said: "As for reciting Basmalah before sleeping 21 times, we do not know any basis for it."
Moreover, it should be noted that nothing was reported from the Prophet, sallallaahu ‘alayhi wa sallam, nor from his companions regarding mentioning the Name of Allaah alone (without any of His other Names or Attributes) such as saying "Allaah, Allaah" and so on. Shaykh Al-Islam Ibn Taymiyyah said in Majmoo' Al-Fataawa: "Repeating the Name of Allaah alone, such as saying “Allaah, Allaah,” or only the pronoun refering to Allaah, such as “Huwa, Huwa” (which means He, He) is not prescribed in either the Quran or the Sunnah. It is not reported that any of the Salaf (righteous predecessors) of this Ummah or any of the righteous scholars who are taken as examples did this. It is only spoken by misguided people of the later generations." [End quote]
Allaah Knows best.