There are a few different ways that you can exercise your legs, but primarily people enjoy squatting and deadlifting. These two primary compound movements are great because they help many aspects of your body without just focusing on a specific muscle group. For example, the deadlift will help not only strengthen your lower back, but also your quads, hamstrings, and glutes as well. These muscles must all work in concert to get the job done.
When it comes to squats, there is also a perfect way you can achieve mastery of the movement. A few of the main things to consider are where your hips are going while you are doing the movement. If you feel your knees are buckling inwards, then you are either lifting too much weight or you need to be more conscious about trying to rotate your knees outwards.
A lot of people who are squatting will tell you that over time it can also hurt your knees. There is a lot of debate about squatting and the pain you might feel in the knees, but if you do them correctly you will not have problems. Make sure you do not go past 90 degrees while in a squat and there is hope for your knees yet.
Finally, make sure you have spotters to help you or belts on your waste. There are more safety precautions that you need to take with a movement like a squat simply because it is a bigger compound movement that definitely requires a lot more finesse. If you are trying to achieve a perfect squat that is going to make your legs stronger and bigger, you need to make sure you utilize this method the best way you can.