Yo, OP, I used to have this exact problem. I knew all the syntax, general rules, etc., but I just could not write anything down. The way I fixed it was that I kept looking at better programmer's code, copied it down word-by-word (don't copy and paste), and then compiled it.
Now you're thinking "but that won't work, I'm not creatively thinking if I do that". While it's true that you won't be thinking creatively, it will make you "get" how their code works intricately. It forces your brain to look at the code closely line by line, rather than trying to read it like a normal book.
Once you do this long enough, you will start predicting what needs to be written next without looking at their code. Keep going, and you'll start noticing ways you could have written it to suit your own preferences. Then, you will actually start thinking like a programmer, and be able to come up with original code.