in reply to incrementing the file
The problem with your approach is, that you have to check an ever growing number of files to determine the current version. The alternative is of course some kind of bookkeeping.
The simplest form I could think about is using a "output_$input_file_current" with a symlink to the real file "output_$input_file_$version". That way you only have to get the real file name of the symlink with readlink to determine the current maximum.