Yes, paying someone to do your assignment work is legal if you are not free or want to achieve the best work.