Fix command argument appending function

Previously we always returned the first element. Now we return the
last one (the one we just allocated), which was intented in the first
place.