"My intention was to craft and demonstrate a flawed main character," the writer said in a statement apologizing on social media.