Prime minister has pledged to repair damaged relations with the European Union for the benefit of ‘generations to come’