Try changing:
if x >= end:
To:
if x >= end and y <= end:
Also, change:
keepgoing == False
To:
keepgoing = False
Also, consider changing:
if x == end and y == end:
To:
if x >= end and y >= end:
Note: You should probably use a nested for-loop and cycle through x-pixels and y-pixels. It may be better than using a while-loop.
solved The same program again