What a lot of video creators and video consumers don't seem to grasp, is that in order to learn something, you actually have to understand it. So I think you're on the right path to notice, that typing someone else's code or copy pasting it from somewhere, isn't very effective in learning its meaning.
I can second Paul's suggestion of trying to build clones of classic games such as Pong, Tic Tac Toe, Tetris, etc. while going through the
official tutorials.
And again, don't just copy the code and try to move pieces around until it maybe works, but actually understand what the parameters mean and why you need to create a window and what events do and how to apply the clear(), draw(), display() steps, etc.
If you're new to C++ as well, it will be a bit harder to understand these concepts, that's why we usually suggest to learn the basics of C++ without SFML.
After you've understood the basics of SFML, I can recommend the SFML Game Development book, which will give you some more tips on how to structure a game, among other things.