First, and foremost, it should be clear that all things in the universe are destined by Allah Who knows the Unseen and what happened and what will happen prior to its occurrence.

Essentially, the Qur’anic position states that while Allah has decreed all things, and that His
Decree is at once all-wise and impeccable, human beings have been granted freedom to choose. The freedom granted to humans, however, does not contradict Allah’s Will or Decree, as it itself is a part of Allah’s Will, since man would not have been able to choose if not for Allah’s Will.
Islam teaches us that Allah is the Creator and Sustainer of this enormous universe and everything it contains in its infinite diversity and multiplicity. He is the Lord of them all, Who is All-Wise, All-Powerful, All-Knowing, and All-Aware. Allah, Who is All-Wise and All-Knowing, has decreed all things in due proportion, balance and harmony. Allah’s creation is immaculately perfect, and there is no discrepancy or disharmony existing in the universe. Almighty Allah says: “(Blessed is He) Who has created seven heavens in tiers. You cannot see any disharmony in the All-Merciful’s creation; look again. Can you see any rift? Then look again, and yet again, your sight will return to you, vanquished and weak.” (Al-Mulk: 3-4).
Stated differently, the Divine Decree or pre-determination is part of the all- embracing knowledge, wisdom, and power of Allah as the Creator. It means that Allah’s Will is supreme, and that Allah is fully in charge of His creation. It teaches us that there is essentially one supreme Will operative in the universe, namely the supreme Will of Allah.

Dr. Rif`at Fawzi, former head of the department of Shari`ah at the Faculty of Dar Al-`Ulum, Cairo University, Egypt, states the following: “Allah’s knowledge is Infinite and Unchangeable. It is His Infinite, All-embracing knowledge which decides what is best for us both in this world and in the Hereafter. We should keep in mind that Allah’s knowledge and Omniscience is not limited by time and other limitation factors. The whole issue is part of the realm of the unseen to which we should submit ourselves willingly making sure that Allah predestines everything and he gave us the freedom of choice.

Regarding the verse you have quoted, I would like to stress that there are different interpretation for it. Some Muslim exegetes state that Allah blots out things that are neither good deeds not bad ones as the angles do write everything.

Also, in an attempt to broaden your vision about predestination and man’s free will, we’d like to furnish you with a detailed discussion given by Dr Ja`far Sheikh Idris, professor of Islamic studies, Institute of Islamic and Arabic Sciences, Washington, who states:
“The original meaning of the Arabic word qadar is a specified measure or amount whether of quantities or qualities. It has many other usages, which branch out from this core. Almighty Allah says, “We have created every thing by measure (bi-qadar).” (Al-Qamar: 49)
Allah (Mighty and Exalted be He) knows before creating anything, that He is going to create it and that it shall be of such and such magnitude, quality or nature, etc. He also specifies the time of its coming into being and its passing away, and the place of its occurrence. If so, then one who believes in the true God should believe that there are no accidents in nature. If something disagreeable happens to him, he should say “Allah qaddara (ordained), and He did what He willed” and not grieve himself by wishing that it had not occurred, or worrying why it should occur. If, in contrast, something agreeable happens to him he should not boast of it, but thank Allah for it. In this context, Allah says, “Naught of disaster befalleth in the earth or in yourselves but it is in a Book before We bring it into being. Lo! That is easy for Allah. That ye grieve not for the sake of that which hath escaped you, nor yet exult because of that which hath been given. Allah loveth not all prideful boasters.” (Al-Hadid: 22-23)
If Allah Almighty predetermines everything, that includes our so-called free actions, in what way can they be said to be free, and how are we responsible for them? This question occasioned the appearance, at a very early history of Islam, of two extreme theological sects. One of them, called the Qadariyyah, asserted man’s free will and responsibility to the extent of denying Allah’s foreknowledge, and claiming that Allah knows our free made actions only after we have performed them. The other, called the Jabriyyah, held the opposite view and claimed that there was no difference between the motions of inanimate things and our movements in performing so-called free actions, and that when we use intentional language we speak only metaphorically.
But there is no need to go to such extremes, since it is not difficult to reconcile Divine qadar (predestination) and human responsibility. Allah decided to create man as a free agent, but He knows (and how can He not know!) before creating every man how he is going to use his free will; what, for instance, his reaction would be when a Prophet clarifies Allah’s message to him. This foreknowledge and its registering in a ‘Book’ is called qadar.
“But if we are free to use our will” a Qadari might say, “we may use it in ways that contradict Allah’s will, and in that case we would not be right in claiming that everything is willed or decreed by Allah.”
the Qur’an answers this question by reminding us that it was Allah who willed that we shall be of free will, and it is He who allows us to use our will. Allah, Most High, says, “Lo! This is an Admonishment, that whosoever will may choose a way unto his Lord. Yet ye will not, unless Allah willeth. Lo! Allah is Knower, Wise.” (Al-Insan: 29-30)
“If so,” a Qadari might say, “He could have prevented us from doing evil.”
Yes indeed He could. Allah says, “Had Allah willed, He would have brought them all together to the guidance; if thy Lord had willed whoever is in the earth would have believed, all of them, all together.” (Yunus: 99) “Had Allah willed, they were not idolaters; and We have not appointed thee a watcher over them neither art thou their guardian.” (Al-An`am: 107)
But Allah has willed that men shall be free especially in regard to matters of belief and disbelief. Allah Almighty says, “Say: The truth is from your Lord; so let whosoever will believe, and let whosoever will disbelieve.” (Al-Kahf: 29)
But men would not be so free if whenever any of them wills to do evil Allah prevents him from doing it and compels him to do good.
“If our actions are willed by Allah,” someone might say, “then they are in fact His actions.”
this objection is based on a confusion that Allah wills what we will in the sense of granting us the will to choose and enabling us to execute that will, i.e., He creates all that makes it possible for us to do it. He does not will it in the sense of doing it, otherwise it would be quite in order to say, when we drink or eat or sleep for instance that Allah performed these actions. Allah creates them, He does not do or perform them.
Another objection, based on another confusion, is that if Allah allows us to do evil, then He approves of it and likes it.
However, to will something in the sense of allowing a person to do it is one thing; and to approve of his action and commend it, is quite another, NOT everything that Allah wills He likes. He has, as we have just read in the Qur’an, granted man the choice between belief and disbelief, but He does not, of course, like men to disbelieve (to be thankless). Allah Almighty says, “If you art ungrateful, Allah is independent of you. Yet He approves not ungratefulness in His servants; but if you are grateful, He will approve it in you.” (Az-Zumar: 7)”
Based on Dr. Ja`far Sheikh Idris’s article “Belief in Qadar”. (Source: http://isgkc.org/pillars_qadar.htm).