Allah تعالى is Wise in His actions and rulings. There are wisdoms in His creation and decree, some of which we may know, while others may be hidden from us.
Allah تعالى knew everything that would happen before it occurred, and then He wrote the decrees of all creation in the Preserved Tablet. Thus, knowledge precedes writing. According to Ahl al-Sunnah, divine decree has four levels: knowledge, writing, will, and creation. Allah تعالى says:
﴿Do you not know that Allah knows what is in the heavens and the earth? Indeed, that is in a Book. Indeed, that is easy for Allah.﴾ [Al-Hajj: 70]
Among the wisdoms behind writing the decrees in the Preserved Tablet are:
Manifesting the perfection of Allah's knowledge; the writing is not because He needs to remember—Glorified and Exalted is He above that. Rather, He is the One of whom it is said: ﴿He neither errs nor forgets﴾. It is instead part of the perfection of His wisdom and decree.
Strengthening faith in divine decree and reassuring the believer; so that he knows that what has befallen him could never have missed him, and what has missed him could never have befallen him. Thus, he submits to Allah's decree and does not grieve excessively over what he has missed. Allah تعالى says:
﴿So that you may not grieve over what has escaped you, nor exult over what He has given you.﴾ [Al-Hadid: 23]
Clarifying that Allah's will is always effective; whatever Allah wills happens, and whatever He does not will does not happen. Creation cannot bring benefit or harm except by what Allah has written for them. The Prophet ﷺ said:
«Know that if the entire nation were to gather together to benefit you with something, they would not benefit you except with something that Allah had already written for you...» Narrated by al-Tirmidhi.
Manifesting the greatness of Allah, the perfection of His power, and the encompassing nature of His knowledge; He تعالى has written all the decrees and circumstances of creation, and doing so is easy for Him. Allah تعالى says:
﴿There is no hidden thing in the heaven or the earth except that it is in a clear Book.﴾ [An-Naml: 75]
Teaching people the importance of writing and recording; if Allah تعالى has written the decrees of things despite the perfection of His knowledge and His being far above forgetfulness, then human beings have an even greater need to write, because forgetfulness and error are part of human nature.
Therefore, Allah's writing of the decrees is not because of any fear of forgetting or possibility of error. Rather, it is a consequence of His wisdom, knowledge, and decree. It contains great wisdoms connected with belief in divine decree, the believer's peace of mind, and the manifestation of the perfection of Allah's knowledge and power.
A Muslim should not give himself over to doubts and obsessive thoughts. Rather, he should return to the Qur'an and to the words of firmly grounded scholars, strengthen his faith through beneficial knowledge and righteous deeds, and praise Allah تعالى for guidance and steadfastness.
And Allah تعالى knows best.