How can I stream the output of Enum.to_list to text for insertion into an editor?

I got a complete program from Dogbert at stackoverflow.

Does Dogbert lurk hereabouts under a different name