How to concatenate old string and new string in mysql procedure
CONCAT will return NULL if any of the inputs are NULL. This suggests that your select thainame... is returning NULL in at least one iteration.

CONCAT_WS will skip NULLs. Try using that instead and see what it gives you. Note the first argument is the desired separator, so if you want to duplicate CONCAT() but with NULL skipping just set that to an empty string, CONCAT_WS('',AttrTH,TmpAttrTH);

This should help you debug the problem. Alternately you can also use COALESCE on your SET TmpAttrTH if you want to set a default in cases where the result might be NULL. If you use COALESCE to set a default empty string you shouldn't get NULL back from the subsequent CONCAT.

Presuming the thainame is in Thai script, you may very well have collation/character set issues, which could be why it is returning null in the first place, your comparison may be failing. Check that all the columns you are comparing have the same character set/collation.

@Rick James is also entirely right that looping in SQL should be avoided, and likely is not necessary in the first place. So ideally rewrite the whole thing without the loop. But the above hopefully will help you get to the bottom of where the problem is.