I think this should work - this is my own answer, please give your inputs
I removed one list to avoid another layer of for loop in the code and performed the reverse-complement conversion in one compact loop. Also, I added the pass - else command to avoid writing 6mers of lines that do not meet the condition.
with open('file.fasta', 'r') as file:
list = []
for record in SeqIO.parse(file, 'fasta'):
cnt = 0
if any(items in record.seq for items in list):
cnt += 1
pass
else:
for i in range(len(record.seq)):
kmer = str(record.seq[i:i + 6])
if len(kmer) == 6:
C_kmer = Seq(kmer).complement()
list.append(C_kmer[::-1])
if cnt == 0:
print('>' + record.id)
print(record.seq)