It will be simple to look for "data" and keep the value of the greatest related index (while searching into config - for example, you find data2, data3, data5, data4 -> therefore you'll kepp 5), increment that value and create the new name.
another solution is to have an entry in your config file or another file containing the next available index for your data file. Every time you save a data file, increment this value. Even if you want to attach something else to the file name, you will have a different index every time ... so, different names. The file names will be like
00001 - one name.dat
00002 - another name.dat
00003 - one name or another.dat
Hope this helps