title: I am trying to dump all data in txt file, but the things it's dumping only last line
body: <p>I am trying to dump table rows in txt file using beautiful soup and python but the things is it's only dumping last line of str.</p>
  <pre><code>html = await page.content()
  
  soup = bs.BeautifulSoup(html,'lxml')
  
  table = soup.find('table', attrs={'class':'a-bordered a-horizontal-stripes mt-table'})
  table_rows = table.find_all('tr')
  
  for tr in table_rows:
      td = tr.find_all('td', attrs={'data-column' : 'purchase_order'})
      row = [tr.text for tr in td]
      listToStr = ' '.join([str(elem) for elem in row])
    
      print(type(listToStr)) 
  
  with open('readme.txt', 'w') as f:
      f.write(listToStr)
  </code></pre>
  <p>I'm attaching some of the output screenshot below :</p>
  <ol>
  <li><a href="https://i.stack.imgur.com/COKDu.png" rel="nofollow noreferrer">data type of listToStr</a></li>
  <li><a href="https://i.stack.imgur.com/ixDrq.png" rel="nofollow noreferrer">data in listToStr</a></li>
  <li><a href="https://i.stack.imgur.com/JhDRF.png" rel="nofollow noreferrer">data dumped into text file</a></li>
  </ol>