Auto populate Group Name

Hello,

How can i auto populate group name by selecting the product. I want to put product custom field value into group name after selecting product in line item.

Please give me a solution