Moving that python line that goes for all eternity into a text file