If you're making a comparison, you generally want to use the same kind of verb conjugation in both sides of the comparison. So you could say "It's better to walk than to take a bus," using the infinitive in both parts of the comparison. Or, you could say "Walking is better than taking a bus," using the gerund form of the verb in both instances. Hope that makes sense! Good luck!