technically it is allowed - but in practice their might be some issues as most airports do not have proper transit facilities in place. If required, an airport official (immigration?) would accompany you from the arrivals to the departure area. As TG and LH interline your bags should be OK. I would also have TG put a note in your record that you are a transfer pax in MAA and do not require a visa to avoid confusion at BKK.