David Cameron has set out his plans for the UK's exit from the European Union, as he steps down as Prime Minister.