I completely understand where you are coming from. Often, I do the same. However, I feel like copying the code by typing it after understanding what every single line means is when you're actually learning. I built a site to teach people to code this way (https://enlight.ml). If you want to learn by doing (it is one of the best ways to learn), you must understand and be able to reproduce it before copying it down.