You were heading towards the write direction until the part where you said God writes down what we will do beforehand. It doesn't matter much though, considering we will be making the choice that God knows (not causes, mind you) anyway. Him knowing our every step doesn't mean we don't have free will. Him knowing our choices and him causing them are 2 separate things. The beauty of his mercy is that he doesn't write anything down until and unless we actually do it, with a little exception (see end note).
Everyone here seems to have the idea that if we suddenly change our mind from what we were supposed to do, then God would be wrong. Thing is he knows that we would change our mind in the first place. He didn't cause it, thus we did have our choice to do what we wanted. He knew what we will choose and what we will avoid. And should we change our mind, he would know that as well.
Allah is a timeless being with no before or after. When it comes to creation, he says "be!" and it is. When someone has such infinite power, you cannot be surprised that he knows all the outcomes of all his creations. Even the angels asked him when he created Adam, the first man, what his plan is. His reply would always be, "I know that which you do not". So, who in this puny world are we to question his plan?
We are merely irrational children with more theories than facts of this universe. Really. How did we learn about this universe? Through observation. This and all the laws that it follows is one of the infinite possibilities from which God have created. And he has encouraged us to learn about it. Go ahead and read the Quran, he has actually given us a head start.
The Quran says about Allah's mercy: Do a good deed, Allah will consider it a good deed. Think of doing a good deed but you're stopped in your tracks from doing it, Allah will consider it a good deed. Think of doing a bad deed but you stop yourself from doing it, Allah will consider it a good deed. Do a bad deed, Allah will consider it a bad deed. Repent and ask for forgiveness (and never do it again), and Allah will turn all your earned sins into sawab (reward for good deed).