Gordon Brown used his time at the Edinburgh International Book Festival to launch a scathing critique of Donald Trump’s foreign policy