You need to do two things: first, eat plenty of high-quality food: lots of fresh fruits and veggies, whole grains, lean protein, and dairy. For excellent advice on exactly what to eat, go to www.choosemyplate.gov and scroll down to "Related Resources" and click on "Dietary Guidelines". You can supplement those dietary guidelines with high-protein shake mixes such as "Muscle Milk". The other element of building yourself up is a sensible exercise plan. Some of that exercise needs to be cardiovascular, such as jogging or even just brisk walking, and some needs to be classic body-building, like weight-lifting, push-ups, lunges, squats, and so on. It would be a good idea to consult with a physical therapist or trainer, who can set you up with a regimen which is customized just for you and your needs.
Workout and drink 3-4 protein shakes including regular meals throughout the day. Drink a shake an hour before you push some weights and a shake after you work out. The goal is to fuel the muscles. Drink a shake before you go to bed to fuel the muscles through the night. Before you know it you'll pack in some lean body mass and muscle
If you're underweight, your first focus should be to get to a healthy weight with diet and exercise, and then work on building a muscular body. So eat lots of lean proteins and veggies. Either three good-sized meals or four slightly smaller meals a day. Three meals should have at least a cup of each a protein and a veggie, and a third cup of maybe whole grain rice or another veggie. The fourth meal is a snack between lunch and dinner, and should be a cup or more of the same stuff.