How to avoid error 24

That is a communication error - The board thinks you got two GCode commands on a single line, but LightBurn does not produce code like this, so the issue is interference in the USB signal between the computer and the machine.