To annoy everyone and make life hard as heck. There is no true purpose behind it and teachers just like to make everyone's home life 10x more annoying. They also do it because 99% of teacher are crazy cat people with no life. So for them homework keeps them busy
The true purpose of homework is to help you learn and get more practice and help one on one with yourself so you can become a better student and better at whatever subject you are currently learning about at the time being.