A Consensus Algorithm for Second-Order Systems Evolving on Lie Groups