Just reading file once. Spaces and apostrophes have been made homogeneous, due to inconsistency in OP.
awk -F"|" '
{
k[$1]=k[$1] OFS $4 # build data string containing giftquantity, minimumpurchase and giftids for each key
}
END{ # after the whole file has been quantified
for(i in k){ # for each key string do the following
n=split(k, r, OFS) # divide the data into tokens
for(e=3;e<=n;e++){ # iterate through giftids found
ids=(ids) ? ids "," q r[e] q : q r[e] q # build the formated giftids section
}
# output the whole nine yards
printf "Key=%s\nGiftQuantity=%s\nMinimumPurchase=%s\nGiftCatalogIdentifier=(%s)\n\n", i, r[1], r[2], ids
}
}' q="'" mohanalakshmi.file