Don't do that!
Use Apple's Script Editor.app (or Script Debugger) if at all possible.
When testing a script use a compiled script in the Finder, and set your macro to run it (instead of a text-script).
Using this approach you can switch to the Script Editor.app, edit, compile, run-to-test, and debug from SE and then run your Keyboard Maestro macro for the final test(s).
That said you can make Keyboard Maestro's edit panel a bit bigger if you insert a bunch of script text and then toggle
View > (Start/Stop) Editing Macros.
On my system with Keyboard Maestro 8.0.4 I get about 22 lines.
I almost never edit anything in Keyboard Maestro's Execute an AppleScript action panels.
I almost never use the text-script option in Execute an AppleScript actions either, because compiled scripts run distinctly faster from KM.
When I do use text-scripts it's usually for something I'm building for someone else or for the forum.
In those cases where I must fool with text-scripts I copy to Script Debugger, where I have proper editing tools, search/replace, and massive debugging capabilities — do my work — and paste back into Keyboard Maestro.
But — I prefer to work with compiled-scripts, so I don't have to wrestle with all that. All I have to do is save in Script Debugger and run from Keyboard Maestro.
If I didn't have access to Script Debugger I'd probably use the Script Editor.app, because of its event logging capabilities. But — Atom (which is free) has a decent AppleScript module, so I'd at least consider using it.