By all means build a gym, but losing weight needs to be done through diet regardless of the gym.
To save money look into calisthenics, to spend some buy a concept 2 rower.
If you really want to get into weights then by an Olympic weight set and a squat rack.