It's because the $kep variable in the where filter is wrapped in quotes. You need to wrap it again in single quotes:
gdalwarp -cutline mask.shp -cwhere 'kepnev="'$kep'"' -crop_to_cutline $kep ${kep/.tif}_masked.tif;done
When I run with echo, I get this output, which looks good to me:
gdalwarp -cutline mask.shp -cwhere kepnev="res_highpass.tif" -crop_to_cutline res_highpass.tif res_highpass_masked.tif
gdalwarp -cutline mask.shp -cwhere kepnev="res_highpass2.tif" -crop_to_cutline res_highpass2.tif res_highpass2_masked.tif
gdalwarp -cutline mask.shp -cwhere kepnev="res_highpass3.tif" -crop_to_cutline res_highpass3.tif res_highpass3_masked.tif
gdalwarp -cutline mask.shp -cwhere kepnev="sj00dsm.tif" -crop_to_cutline sj00dsm.tif sj00dsm_masked.tif
Addendum
Actually, i got my quotes slightly wrong because you may need to wrap the entire where clause in single quotes. After a bit of educated guessing, I've come up with this:
gdalwarp -cutline mask.shp -cwhere "'"kepnev='"'$kep'"'"'" -crop_to_cutline $kep ${kep/.tif}_masked.tif;done
Which gives me this:
gdalwarp -cutline mask.shp -cwhere 'kepnev="sj00dsm.tif"' -crop_to_cutline sj00dsm.tif sj00dsm_masked.tif
"are expanded in Bash. Variables in single quotes'are not expanded. You can also escape single quotes with\'. – j08lue May 01 '17 at 06:30