Why does my code run successfully but give not output?

because your print contains end=""

usually the \n is used to flush the output.

if you want to force it to flush the buffer (so to print it without the \n) you can add the flush option :

print(lines,end='', flush=True)

But maybe you just want to remove the end keyword:

print(lines) 

When to use end=''?
When you use the end parameter you replace the usual \n (carret return) by something else, that is useful if you want to display a série of things next to each other without going next line everytime. (for instance if you want to print a dot . or x for each call to a function that you're calling in a loop for a big number of times.

And yes it should be end and not ends

See reference here :
https://www.w3schools.com/python/ref_func_print.asp