ANSWER:
Allah had written all what is going to happen till the day of judgement and that was 50,000 years before He created the creation.
Everything is written down but we don’t know what Allah had decreed!
We can’t blame the divine decree for our sins and shortcomings. It is we who make our own choices and we have only ourselves to blame.
Would you jump from a high riser and say:if Allah decreed that I shall land on my feet safe and sound, it will happen?
Of course not because it is your choice not to do that.
Likewise with believing in Allah and Islam and doing good deeds or bad ones. It is you who choose!