One problem there was that there was no space between the first and the second LIKE.
You'll have to add the AND yourself.
If you do that in the loop, you'll get one AND too many at the start:
SELECT * FROM table WHERE AND LIKE'%....
to solve that, you can put in one useless statement at the beginning, after which you can put the AND:
SELECT * FROM table WHERE 1=1
After that, and AND is valid.