Inputting your data into Timatic (the database used by airlines) yields these results:
TWOV (Transit Without Visa):
Visa required, except for Nationals of India transiting through Frankfurt (FRA) or Munich (MUC), arriving from a non-Schengen Member State with a confirmed onward ticket for a
flight within 24 hours to a third country which is not a Schengen Member State. They must:
have a residence permit issued by the United Kingdom, and
stay in the international transit area of the airport, and
have documents required for their next destination.
Therefore, you don't need a visa for either Munich or Frankfurt if you are not transferring between them as well. In that case, you'd leave the international transit area and enter Schengen for an intra-Schengen flight.
You need to make sure that you have your luggage checked through and are not self-connecting so that you can stay in the international transit area. Don't follow the passenger flow, but ideally ask the staff at the gate where to go for international connections inside the transit area, the layout can be confusing.