What changes are you currently making in your bodyweight? Consider your answer honestly -- I don't care whether you've been gaining weight, losing it or maintaining it. Just make sure you're aware of what's going on with your body so that you can make adjustments as necessary.
Increases in muscle mass and decreases in body fat are largely conflicting goals. As a beginner, you may be able to achieve both at once to a certain extent, but in general it's easier and more effective to focus on one body composition goal and then the other, because to grow muscles generally requires an excess of calories available to convert into lean body mass, while a reduction in body fat generally requires a deficit in consumed energy relative to your daily usage. In other words, the best way to gain muscle mass is to gain weight (while doing strength training) and the best way to lose fat mass is to lose weight (also while doing strength training). This means that other than following a good program (like the one I'll link you to and talk about below), you need to be eating appropriately for your goals.
The good and bad news is that you've got a lot of options here, since there are so many ways to achieve the results you're after. There are literally thousands of different routines that will work for someone in your shoes...but there are many more thousands of routines that are just a bad idea (and, as you've already discovered, not everything will work).
I'm going to make life simple for you by giving you only one program option. The only concession I'll give you is alternative exercises if, for whatever reason, the exercises in the main program aren't appropriate for you (eg injury, movement is too technical, not yet strong enough for the exercise, etc).
http://training.fitness.com/young-athlete-development/young-athlete-development-program-50627.html
This is a program I wrote primarily for teenagers who need to get stronger for sport, but the principles of strength training and the principles of building muscle are more or less the same, especially when you're still a beginner. Have a read through the thread.
The exercises covered in the program are: Squats, press, power snatch, dips, and pull ups/chins ups. The 45 degree leg press, taken to full depth (while keeping your hips down on the bench) is a suitable substitute for squats. You shouldn't need a substitute for the press, just use dumbbells if an Olympic barbell is too heavy for you. Box dips (which are described in the second post) are a good substitute for normal dips. If your shoulders aren't okay with any form of dip, go for bench press (like the press, you can use a barbell or dumbbells). If pull ups and chin ups are too much for you, just use the lat pulldown machine. Power snatches are where people are most likely to freak out without one-on-one coaching. If possible, I'd recommend learning them over not learning them, but if you're unwilling or unable to learn them correctly, simply do snatch-grip deadlifts or snatch-grip shrugs as described in the second post, or do snatch-grip high pulls (just like a snatch-grip shrug, except you let your elbows unlock and have the bar float up to mid-torso level). Other than these optional variations, do the program as written.
I hope you find this helpful, and not
too overwhelming.