Change this:

    Account.Name = ':accName'

to this:

    Name = :accName

so your entire query would be:

    Account accountId = [
          SELECT Id, Name FROM 
          Account where Name = :accName AND Account_External_Id__c != null 
          LIMIT 1
      ];

saying `= ':accName' ` is looking for Accounts with the literal value ":accName" since you wrapped it in single quotes. You don't need single quotes around SOQL bind variables.

You should not have this SOQL query within your for loop - please see [Apex best practices.][1] For every iteration of your loop, you will accrue a SOQL query - this will quickly hit governor limits in any type of bulk scenario.


  [1]: https://developer.salesforce.com/page/Best_Practice%3A_Bulkify_Your_Code