In sentence B, the first verb is followed by a gerund (-ing) form. The verb patterns are ... If you want to lose weight, try doing more exercise. In this case, we use try when we suggest a way ...
Gerunds are the -ing form of a verb, and infinitives are the to + base form. These words can be confusing; they combine the meaning of a verb with the grammar of a noun. My father asked me to ...