I looked at it and i dont understand what you are trying to achieve.
i only assume you change values from column Group to Group Level 1 If it is Temp1, then Group Level 2 if it is Temp2.
You wrote a MASTER table code, but what is a puprose of it? I would use mapping table in DB or XLS to map values instead.
Can you present us with what are you trying to avchieve? From--> To?
That would help me understand. Your current code is just a hardcoded conversion, in my opinion is not a dynamic solution.