there is no need to use a while, because on the local node were simOutput is created the folder is always visible after mkdir. This means we only move one loop round. This sleep is only  a workaround for slow filesystems with bad nfs.