title: appending list output to another -python
body: <p>I am trying to write output of one list to another and I opened an empty list and did an .append(). How ever it gives me an error? I Have mentioned the error below.</p>
  
  <p>What I need?:</p>
  
  <p>the output of list 1 should be put into list 2, shuffle all the lines in list 2 and write that output to a file called random_lines.</p>
  
  <pre><code>def main():
  c = int(sys.argv[1])
  if c == 1:
      rep()
  elif c == 2:
      Line()
  </code></pre>
  
  <p><code>def rep():</code></p>
  
  <pre><code>n = int(sys.argv[2])
  m = int(sys.argv[3])
  count = 0
  with open(sys.argv[4]) as f:
      list1 = random.sample(f.readlines(),n)
      list2 = []
      while (count&lt;m):
          for i in list1:
              list2.append(list1)
              count+=1
              random_lines = random.shuffle(list2)
      with open(sys.argv[5],"w") as outcsv:
              print &gt;&gt; outcsv, ''.join(random_lines)
  </code></pre>
  
  <blockquote>
    <p>print >> outcsv, ''.join(random_lines)
    TypeError: can only join an iterable</p>
  </blockquote>
  
  <p>What mistake am i making?</p>