How to write the result of the command

how to write the result of the command System.out.println (ListingId) to a file

No way.

The output from System.out.println(xxx) in a Test Case of Katalon Studio goes into the “Console” view of Katalon GUI. You can not redirect it (pipe it) to a file.

is there a commadn that can be implemented?

No, you can not save the output from System.out into file. Why? See this post

Of course you can write a string into an arbitrary file directly by your Groovy script. If you want to see an example of usage, for example I found the following:

You need to manage file (open it, println into it, close it) for yourself.