You can create a system command that contains linebreaks with sprintf
:
system_command = sprintf('cat > my.txt << EOF\n');
system_command = sprintf('%s\nbla-bla-bla', system_command);
system_command = sprintf('%s\nbliblablub', system_command);
system_command = sprintf('%s\nEOF', system_command);
system(system_command);