If you have an Android, the location depends on where the game is located (SD card or phone's internal memory).
To check if your app is on the SD card (if you have one) or in the phone's memory, simply go through Settings/Applications, and you'll be able to see where the game is located (you also have the possibility to move the app to your convenience).
Then, use your phone's File Explorer or go in the Play Store to find one (File Explorer).
Once you're in the explorer, go to Android/data (whether SD card or phone memory), and you will see many folders like com.xxx.xxx. Find the one with Temple Run 2 in the name (can't remember the folder's name), open that folder and you'll find the files you're looking for.
If you linked your Google Play Games account with the game, logically your progress would be saved in your google account. So a factory reset shouldn't make you lose your progress. You'll just have to re-link with Play Games once you reinstall the app.
I suggest you copy the whole game folder on to a USB drive or on your computer before the factory reset. I'm not 100% sure that all the progress is saved on the GPG account, so it's safer in my opinion.