1. you are looping (twice) over the {.if.}
getting as a result Default.tplDefault.tpl
then you pass this to {.load.} but it's not an existing file.
the logic is wrong.
this is a possible way to correct
fn = default.tpl
for iphone,MSIE
if %cur% in user-agent
fn = %cur%.tpl
load(fn)
when something goes wrong with scripts, you should: debug > enable macros.log
and read what's happening
2. since {.count substring.} returns a value that's a number, zero or positive, you can avoid using {.>.} because zero will be considered as "false" and the positive as "true".
3. i think you can use {.pos.} instead of {.count substring.} because you are not interested in how many times it appears, but if it appears at all.