If you want to do it your way:
for i in range(1, 21):
print(i, end="," if i!=20 else "" )
Output:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20
But a better way of doing this would be:
print(*range(1, 21), sep=",")
solved How to remove the last comma?