Refactored code. Created print function

print function -
print(char *str, int x, int y);