Read/write a pipe-delimited file line by line with some simple text manipulation
Here is another way to organize your code. Instead of an if within the loop, use iterators more explicitly. Concretely:

with open(r"C:\Path\name.txt") as source:
    lines = iter(source)

    # first line
    first_line =  next(lines)
    with open(r"C:\PATH\2019.txt") as summary:
        # ... omitted ...

    # remaining lines
    with open(r"C:\PATH\PythonWrittenData.txt", 'a') as dest:
        for counter, line in enumerate(lines, start=1):
            # ... omitted ...



I have also used enumerate to update counter and line simultaneously.

The other answer has some more tips on writing good python code. But as far as structuring the opening and closing of files, as well as the main loop, this approach should get you started.