To build muscle you need extra calories.
To lose weight you need fewer calories.
You have to choose.
Some people have been able to master the skill of doing both almost at the same time: maybe working out one day to build and the next day to take down, I don't know how or if they do this sucessfully but by logic and as your starting out, I'd say pick one over the other first.
Cardio gets your heart rate up, makes you sweat, leaves you breathless. Things like running, cycling very fast, aerobics classes..etc aim for 60-90% of your max heart rate (roughly 220- your age = your heart rate max). Aim to do at least 30 mins each day or 1 hour 3-4 days a week minimum (not incluing warming up or stretching) if you can do more this is great. The recommended exercise per person is 30 mins a day every day.
If you don't want to lose any weight, then after warming up for about 15 mins on the cardio machines, take to the weights. As for which weights to do, I don't think I'd know- plus I think posture is vital, the wrong posture can render an exercise pointless at best and at worst cause a horrible injury. If your at a gym get a professional talk you through the machines, its what you pay your fees for. Get some tips and a programme from them and mention things you disike intensly, there is no point having a programme you don't want to follow as you hate it!
Food is very important in terms of weight loss. Eating healthily is the best advice but I am sure there are many more stickies on this in the forums.
Protein: 1.5-2 grams per kilo of your body weight.
Carbs: complex carbs when you do eat them, n/b brown rice is not a complex carb, brown bread is not a complex carb, both are just the white refined form but dyed with brown dye. Wholewheat rice and wholegrain bread are complex carbs.
Fresh fruit and vegetables: 5 portions a day minimum, 3 of those to be vegetables, needs to be at least 80grams to be considered a portion.
1.5-2L of plain water a day every day. Very important!
Try to steer clear of the beer! It wont do you any favors
