Hello @Lucas Cruz
Please use the following script below to achieve this:
$groups = Get-ADGroup -filter * -SearchBase "OU=path,DC=domain,DC=com" | select -exp samaccountname
ForEach ($group in $groups) {
Set-ADGroup -Identity $group -Replace @{mail=$group + '@example.com'}
}
Borrowed parts of the code from https://community.spiceworks.com/topic/2042327-pull-users-from-a-group-that-are-in-a-specific-ou and https://serverfault.com/questions/567279/how-can-a-set-a-security-groups-email-address-using-powershell and customized it to your specifications.
-------------------------
If this helps please don't forget to mark as correct answer.