Actor acknowledges ‘unfortunate’ lines in script and says film ‘vilified’ transgender community.