Querying A Record
To update a record, you must first have a copy of a record in memory. This means you need a CampaignMember object to update:
CampaignMember queriedCampaign = [SELECT ID FROM CampaignMember WHERE CampaignID = :campId AND Email = :email LIMIT 1];
In general, you declare and assign values in the form of:
DataType variableName [=...
SOQL within for loops is an easy way to hit your governor limits and doesn't follow best practice. This link on Apex Best Practices is a good place to start :)
To avoid using SOQL inside a for loop I find maps the easiest to work with. The solution would look something like this.
// by using just the before triggers we can update the value of SAP_Matrix__c ...