Vinegar and sugar make good preservatives. Provided you use sterilised containers - place them in boiling water for twenty minutes, add the sauce, seal, then boil again for ten minutes - you should be fine. Store the bottles/jars in a cool place out of direct sunlight.
Avoid using oil during preparation, as you run the risk of introducing Botulinium into the mix. This would probably be neutralised by the vinegar, but it really isn't worth the risk.
As always, if the sauce smells or looks suspect when you come to use it, throw it out. Again, it's not worth the risk of food poisoning.
Tomatoes aren't high acid, so they need the addition of vinegar or lemon juice in order to safely can with a hot water bath. Honestly, I'm not sure why you would want to make tomato sauce from canned tomatoes because for me, the whole point of canning tomatoes is because the tomatoes will otherwise go bad. But anyhow...
I recommend finding a tomato sauce recipe from a canning cookbook or recipe website. Here is a recipe I found from the Ball website which is a reputable source, and here is an article about hot water bath canning tomato sauce. Notice that the recipe calls for a high acid ingredient, which is extremely important in canning tomato sauce with a hot water bath!
Secondly, it is NOT okay to seal jars by inverting them!!!! Get yourself a book about canning, Ball sells several good ones (Blue Book and Complete Guide to Home Preserving) and learn about the canning process. The steps are as follows:
(0) Follow the recipe EXACTLY, don't add any other ingredients that may change the pH of the final product!
(1) Get the hot water boiling in a jar large enough to have a few inches both above and below the jar that you'll use. You can use a metal trivet or canning rings to act as a base for the jars so that they have water going under them and aren't touching the base of the pot directly.
(2) Start with jars that are appropriate to canning and have fresh lids (or clean, working reusable lids like Weck jars or Tattler lids). If processing for under 15 minutes the jars need to be sterile (can be made sterile in a hot water bath). Inspect Tattler seals for any nicks, and throw away the bad ones.
(3) Normal canning lids and Tattler lids need to be prepared by soaking in hot water right up until use.
(4) Add the ingredients to your jars, remove air bubbles with a spatula, wipe the rims clean, and apply the lid as per the instructions of your lid. (Regular Ball lids are slightly different from Tattler lids, and I've never used Weck jars which I think are different again.)
(5) Insert into the hot water bath with canning tongs, cover, make sure that you start the countdown once the water has returned to a full boil.
(6) Remove once the time is up. Don't tilt the jars when removing them as the seal isn't airtight yet. Check the instructions for your lids, at this point Tattler lids have to be tightened fully.
(7) Leave the jars alone to cool. After a few hours or overnight, check the seals by trying to gently pry open the can. They should be "finger tight" and not pop off. The jars that aren't properly sealed can be put into the fridge and consumed within a short time. Otherwise they're good for up to a year or whatever the recipe suggests.
Best Answer
With just those four ingredients (plus maybe some seasonings), your hot sauce will be a "low-acid food" which means that to be shelf-stable, it needs to be canned at 240F/115C. This means that you will need to use pressure canning to seal it (pictoral guide). If properly pressure canned, it should be shelf-stable for months to years.
This has two drawbacks for you: first, it requires getting a pressure canner (or using a pressure cooker and really small batches). Second, it does mean that you're going to be cooking the hot sauce at 240F, which may lead to it being more "cooked" than you necessarily want it to be. If you have a pressure cooker around, I suggest trying that with one jar and seeing how it tastes.