A man who was involved in stealing thousands of pounds from hundreds of cash machines across the UK has been jailed and will be deported.