title: The print of while loop into text file
body: <p>I've done this in python. When I insert a word, it'll repeated with after a digit
  For Example if I insert stack, it-ll print:</p>
  
  <pre><code>stack 1
  stack 2
  stack 3
  stack 4
  stack 5
  stack 6
  stack 7
  stack 8
  stack 9
  </code></pre>
  
  <p>I want that python to print the name and the digit in a file text. I searches but didn't find anything.</p>
  
  <p>Code:</p>
  
  <pre><code>pwd=raw_input("Enter a word:")
  n=0
  n=str(n)
  print (pwd,n)
  while n&lt;9:
    out_file=open("tesxt.txt","w")
    n+=1
    out_file.write(pwd)
    out_file.write(n)
  out_file.close()
  </code></pre>
  
  <p>I want that python to write the words that are generated from the loop.
  Thx for the help</p>