Hello Alex and welcome to PSG.
(There are many ways to do things in Photoshop, this is one way.)
While simple, these types of effects require a basic understanding of selections. So let's start there.
The rule is that you can only work on the inside of a selection. A selection (or some call it a marquee) is identified by the marching ants.
So if I have a selection like the one below....
........and I make a swipe at the selection with the Brush Tool, I will only see the color inside the selection.
Taking the same selection as the first image above and inverting it like this.............
I now have marching ants on the original ellipse as well as the outside edge of canvas.
So now where will a brush stroke appear?
It will still always appear inside the selection like this.......
In order to make the effect like the one you asking about, you must first make a selection on your canvas.
Here I have used the Pen Tool to make the selection.
Then I used the Brush Tool to add in the color.
Hit Cmd/Cntrl + D to deselect............and your done.