Execute multi-line commands in device