How can I make an infinite loop in Python in Blender？
Blender scripts are not subprocesses: if you trigger an infinite loop in a script/addon, Blender will freeze as well until the script finishes what it is doing.

The reason why you can't see an outout is that Blender's print() funtion displays the text in the console window, that you can open in Window -> Toggle System Console

If you execute your script then you'll see that your text keeps being written and the script is working



If your code is very long you could make it a subprocess or execute externally (but you rarely need to do it), while if you just need to execute it once in a while you can use modal operators

with modal operators, for instance, you can  execute your script every 0.1 seconds and make it print your text, so in that 0.1 second Blender has time to update the UI