You can't add XC4 code to XC5 files. It won't work. And you can't add it directly to the cart files - you have to do it with a module.
You have to look at the CheckoutSuccess.php in the View directory, there's probably one, find the template it's calling to load, eventually modify that template through the theme template editor or have new file with the view list as the rest of the "thank you" page files.
- although it is for XC 5.3.x the general process is the same