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 is His slave and Messenger.
Writing foul words in the Mus'haf is an evil crime; it even indicates disbelief and apostasy from Islam. It is one of the deeds of wicked sorcerers through which they summon devils. Satan is keen on enticing man, leading him to deviation and taking him away from his religion. Shams Al-Ma‘aarif Al-Kubra is a book of sorcery and falsehood. It is impermissible to read it or to act on what is written in it.
You were right when you burned the two books and concealed his sin, hoping he would sincerely repent. It was also correct to inform the concerned authorities after he had returned to his deviation and falsehood.
If it is established that a person uses sorcery or desecrates the Mus'haf, he is asked to repent and if he does not then he must be killed. Imaam Maalik and Imaam Ahmad were of the opinion that a magician is to be killed without first being asked to repent. This is because the Companions killed magicians without asking them to repent, and because the knowledge of sorcery is not removed by repentance.
It was narrated on the authority of Hafsah that she killed one of her bondmaids because the latter had bewitched her. [Abd Ar-Razzaq] It was also narrated on the authority of Jundub that he did the same. Imaam Ahmad mentioned that killing sorcerers was narrated on the authority of ‘Umar, Hafsah and Jundub .
Similarly, Bajaalah narrated that ‘Umar wrote and told him to kill every male and female sorcerer. [Al-Bukhari and ‘Abd Ar-Razzaaq]
Allaah Knows best.