Particle acceleration during the coalescence of two magnetic loops in electron-ion plasmas