There is nothing wrong with using the gift of tongues to thank God. In fact, it is something that Paul commends. The problem arises when this is done in public worship (without interpretation), because then the other person
(the person who cannot understand the tongue) is not built up.
17 For you may be giving thanks well enough, but the other person is not being built up.