Assuming you are doing a major upgrade, there are two general solutions:
If your upgrade is scheduled "late", such as afterInstallExecute, the upgrade is installed "over" the older product, so file overwrite rules are aaplied. For data files, this means that if the file has been updated after the install (modify date > creation date) it won't be overwritten:
Neither File Has a Version
In other words the upgrade will just work and you don't need to do anything at all.
If your upgrade is scheduled "early", such as afterInitinalize, it's effectively an uninstall followed by an install so you'll lose the file in the uninstall. In these cases it's usually better to copy the file to a safe location with a custom action before the upgrade (before RemoveExistingProducts) and then restore it in the upgrade. Or make the app keep the actual data in a copy file which is separate from the one in the install, so the one in the install is a "template" rather than the actual live one.