You just need to add a newline character: "\n". Also, you could rewrite the line in question to make it a little cleaner.# if you're using Python 2.5
outfile.write("%s,%s,%s,%s\n" % (SPECIES, ECO_ID, OCCUR, COUNT))
# if you're using Python 2.6+
outfile.write("{1},{2},{3},{4}\n".format(SPECIES, ECO_ID, OCCUR, COUNT))
# or this...
outfile.write(",".join([SPECIES, ECO_ID, OCCUR, COUNT + "\n"]))