You can either take notes while you are learning something, or afterwards. That means you can write notes in the class/as you are reading, or you can do it afterwards.
The approapriate timing varies with the difficulty of the content. It can be a bad idea to take notes when a class is hard, which itself demands all the attention you have got. You may find yourself hurrying between listening to the lecture and taking notes if you try. Note-taking itself is not usually an easy task. You need to understand the information, organize it, and format it on the note. It competes your mental resources away from understanding the content. You will inevitably end up with some messy verbatim notes or a fragile understanding in the end, sometimes both.
Your cognitive resources are limited, and trying to use more than you have calls for attention-switching and multitasking. Just as you wouldn’t chat while you read, you don’t want to spend your attention elsewhere when you are learning something really hard. A lot of time full-fledged note-taking is only a distraction. Occasionally you may note down a point or two worth emphasizing, or sketch something to help you understand what is going on. But these things will probably look too primitive to be called notes in a conventional sense.
If you still want to write up a note, you can do it afterwards or while you revisit the material. With some basic understanding present, the content requires less cognitive resources to make sense of. And here you are no longer occupied with the task of absorbing new knowing, so taking notes here will not interfere with anything.