delete $gen instead of echo an empty line in it at start

To avoid the block of code at the end to be executed if no update was needed.
"[ -f $GEN ] && {..}"