try: following will provide you output in same order of $1 in your Input_file.
awk -F, '!($1 in a){++i} {a[$1]=a[$1]?a[$1] OFS $NF:$1 OFS $NF;}{b[i]=a[$1]} END{;for(j=1;j<=i;j++){print b[j]}}' OFS=, Input_file
EDIT1: Adding a non-one liner form of solution too here with a line by line detailed explanation too. I hope this helps you.
awk -F, '!($1 in a){ ####checking here if $1 is not present in array a. If not then go to following block to execute statements.
++i ####increment value of variable named i with 1 each time cursor comes into this block.
}
{
a[$1]=a[$1]?a[$1] OFS $NF:$1 OFS $NF; ####putting array a value and concatenating its value if that is already present using ? and : operators.
}
{
b[i]=a[$1] ####creating an array b whose index is value of variable i and whose value is array a with current lines $1.
}
END {;
for(j=1;j<=i;j++){ ####starting a for loop now whose value will go till the value of variable i from 1.
print b[j] ####printing the value of array b whose index is variable j.
}
}
' OFS=, file117 ####mentioning the value of output field separator as , and mentioning the Input_file name too here.