Replace concat.rb with latest stdlib equivalent

Sync concat puppet function to fix some bugs

Related-Bug: #1320184
Related-Bug: #1321284

Change-Id: I49a614122469b37b1c4eb2fbc29b0877a4427fbd