I think I understand what you're saying. Try making these changes:
for line in open("data.txt"):
new_line = line.rstrip().split()
^^^^^^^^^
if "blocked" in new_line:
if "src="+ip.strip() in new_line:
#write columns to new text file
ip_file.write(", " + new_line[11])
ip_file.write(", " + new_line[12])
try:
ip_file.write(", " + new_line[14])
# ^^^^
except IndexError:
pass
ip_file.write("\n")
#
It seems that the problem was that when new_line[14]
existed, it already contained a newline, so you were appending two newlines. The above code rstrips any newline off line before you split it, then appends a single newline no matter what at the end of the inner for loop.