First, note that when you are gliding with your legs extended, your ankles should be touching and your legs together. This is how you start and finish the leg movement.
Second, let's discuss what makes you go forward. The forward motion is caused by the inner shins of your calves and the inner ankles (when you get more advanced you can also add the bottom of your soles). So, the more water you push backwards with these parts of the leg, the more powerful breaststroke kick you will have.
Third, how to actually move your legs during the kick?
1. When your arms are coming together with your elbows and your body is starting to lift out of the water for a breath, this is the time to start moving your legs. Bend your knees and bring your heels straight back towards your butt. It is important that you don't bring your knees forward. Of course, there has to be forward motion with the knees a little, but it is very limited. This way you are not creating a resistance movement by going against the water forward if that is the way you want to go. The best way to practice this is to be on your back and when bringing your heels back to your butt, keep your knees under water.
Your knees are about a foot apart in this phase of the stroke and your feet are turned out to the sides.
2. The second phase is the kick itself. Kick outwards (better yet backwards), however, not like you are kicking just outward (is this confusing?:). You need to create sort of an outward+ inward sweep with your legs below the knee where the inward/backward kick is the movement that gives you the surge forward. Remember what pushes you forward, the inner calves and inner ankles, so those are the ones that you need to be pushing the water with (viz the picture - don't laugh, I am no artist :)). In order for the inner ankles to be effective, your feet are turned out as the red circle shows you on the video which is at the end of this post.
At the same time thrust forward with your hands and stretch your body on the surface, allowing your hips to rise to the surface.
3. To finish the kick and the final surge forward, you will use the soles of your feet. Imagine, you have fins (flippers) on and your legs are straight. The only part of your legs you can move are ankles. How do you make yourself go forward? You use your ankles to thrust your feet and the soles of your feet (fins) toward each other to create the forward motion.
Now, let's see it in practice. The best way to learn :)
The next video is an interesting example of a breaststroke kick during a breaststroke pull out. Remember that in the breaststroke pull out one is allowed to combine the breaststroke kick with a very slight (not forced) dolphin kick.
So, now you might wonder, why the separate articles on arms and legs. Well, research suggests that legs are much more important in generating powerful breaststroke, so it is important to break those apart. However, note that in order to have an efficient, fast breaststroke, one needs to find an equilibrium and sync in the arm and leg movements. If you think you already know how to swim breaststroke, check out the top 5 common breaststroke mistakes article. So go on and try it out, first separate then together and play around with it. And remember "Breaststroking is fun" :).