Concatenate every n-th line from multiple large files in python

I am looking for a way to concatenate every second line from all the files so the desired output file would be:

sad
er
1
rad
ir
3
saf
gr
5
7
9

I successfully manage to do it using the following script for my test files:

import os

globalList = list()

for file in os.listdir('.'):
if file.endswith('txt'):
with open(file, 'r') as inf:
l = list()
n=0
for i, line in enumerate(inf):
if i == n:
nline=line.strip()
l.append(nline)
n+=2

globalList.append(l)

inf.close()

ouf = open('final.txt', 'w')

for i in range(len(max(globalList, key=len))):
for x in globalList:
if i < len(x):
ouf.write(x[i])
ouf.write('\n')
else:
pass

ouf.close()

The above script works fine with small test files. However, when I try it with my actual files (hundreds of files with millions of lines) my computer quickly runs out of memory and the script crashes. Is there a way to overcome this problem, i.e. to avoid storing so much information in RAM and somehow directly write the lines in an output file? Thanks!