print to file draw rectangle function