Here is the script, that will find all groups computer belongs to and if they start with some special prefix (defined in the code as AD_GROUP_PREFIX constant), it will take a description, that's using the same format as a base variable for Install Software step (PackageID:Program Name) and will add it to the variable defined in BASE_VARIABLE constant. Run it before Install Software step, and by just adding computers to AD groups you will get the software installed. Put this script under "Scripts\Custom" folder on your MDT Package.