As others have stated before, switching from Script tab to the Manual tab and back completely reformats the code and introduces bugs.
See Disable autoformat when switching mode or save test case · Issue #353 · katalon-studio/katalon-studio · GitHub & Is it possible to stop editor from inserting blank lines between statements in script mode
I have not seen any update on this issue and wondering if anyone has figured out how to disable it as it is a major issue for our team.