It's not as simple as that...
It's not clear to me how it is copyright infringement if the generated code is truly new. Of course, if some code output is very similar to existing code, then it is obviously copyrighted.
When you read code from an open source GPL repo and are inspired by it to write your own code, it's obviously not copyrighted.