I’m afraid that I don’t know much about Quest stair handlers but if the code you have posted is in your code components I would strongly suggest that you rely more on Builder components rather than trying to replicate their functions in code.
You won’t be able to save a custom log file online.
Why is your staircase loop in code? Your parameter level appears to be part of that loop.