A for loop won’t do it because you need something to manage the passing of time. The two options are a metro (or delay), or an ASL.
Since 1.0.3 you can simply use the lfo function like:
-- assign an LFO to out1 with duration of 0.1s, 5V scaling & square shape
output[1].action = lfo( 0.1, 5, 'now' ) -- assign it
output[1]() -- start the LFO
-- or execute it immediately
output[1]( lfo( 0.1, 5, 'now' )
Or in pre 1.0.3 ASL:
output[1].action =
loop{ to(5 , 0)
, to('here', 0.05)
, to(-5 , 0)
, to('here', 0.05)
}