I have created a code to print the equation y=x^2+3
However it looks like every time I finish it the y axis has multiple numbers, like top to bottom-19,
As you stated, you need to draw the graph "backwards": first print the empty lines between the current y and the previous one, then print the current y value. You need to put the "*" print at the end of the outer loop (the loop on x)
Next issue is the number of empty lines. Between 19 and 12, you should only have 6 empty lines, because you don't count the line 19 and the line 12.
old=19
new=12
#your code
old-new+1= 8
#actual number of empty lines
old-new-1=6
Next, you have repeated numbers in the y axis because you're always printing the same y. Here:
for lines in range(0,difference+1):
print('{0:>3}'.format(str(y)+'|'))
The y stays the same, and is equal to the "new" value. You need to decrease y from "old value -1" to "new value +1". Something like oldY=oldY-1, print(oldY).
Finally, you never update oldY. At the end of the outer loop, you should have oldY=y