Basically I need to write a line to a txt file containing details about a product, these details are from another text file which I split. The final detail which is the quantity variable is an inputted number.

```
document = open('Task2.txt', 'r')
strquantity = str(quantity)
for line in document:
    the_line = line.split(",")
    if the_line[0] == GTIN:
        with open("receipt.txt", "a") as receipt:
            receipt.write(the_line[0] + "," + the_line[1]+ "," +the_line[2] + "," + strquantity)
document.close()

```

The task 2 file contains:

```
12345670,spatula,0.99
57954363,car,1000.20
09499997,towel,1.20

```

The quantity number is 5 and the GTIN number is 12345670. The line it should write to the file is:

```
12345670,spatula,0.99,5

```

But instead it writes:

```
12345670,spatula,0.99,
5 

```

(no line space (five on the next line under))

Why does it do this and how do I make it so it just writes to the 1 line? Thanks.