That's just what coding is. Please don't lose motivation. I know it's hard and demoralizing, but I strongly encourage you to not give up hope.
Even now I'm learning a new language (clojure) and despite 'knowing how to code' and working in this field for 3+ years, I still spent all day setting up a development environment and learning to loop through a list. That's just how it goes.
I still feel like the same idiot I was on day 1. Except now younger people at work look up to me, as though I actually can code or know what I'm doing. How this happened I do not know. All I know is that I kept at it every day for years, starting from that first day when I tried to understand what a difference between a list and a dictionary is.
At 8 I was indeed "just stuck trying to make your stupid loop not give you a syntax error". Probably lack of an ego at such a young age you just get on with it and not care much.
Adult learning to code is going to be like adult learning foreign language or adult learning to swim. Just like a child but the ego getting in the way getting stressed that it is hard.