присвоить результат DIFF в переменную в скрипте оболочки
some_var="$(diff "./helloworld$x.out" "./output/helloworld$x.out")"
Worried Wildebeest
some_var="$(diff "./helloworld$x.out" "./output/helloworld$x.out")"