building a search functionality
You have exposed an injection vulnerability. 

'WHERE Name like \'%'+accountName+'%\''


Any time you merge user input into your query, you should call String.escapeSingleQuotes, or better yet, use a dynamic binding.

// OK
searchQuery += 'WHERE Name LIKE \'%' + String.escapeSingleQuotes(accountName) + '%\'';

// BETTER
String fuzzySearchTerm = '%' + accountName + '%';
searchQuery += 'WHERE Name LIKE :fuzzySearchTerm';