Lee Anderson has been ordered to apologise to the Commons for breaking bullying and harassment rules.