k I'm going to download Ubuntu anf put it on my USB stick and reformat my PC. It should work after that, right?
Don't do that. If anything, use the Ubuntu live cd/dvd to boot to the Ubuntu desktop and see if the machine cuts off; otherwise don't bother.
I looked at the video, but could not tell if it was shutting off or just rebooting.
Send it back to where it came from and have them fix it under the warranty. This is exactly what it's for. You payed good money for it, so use there free labour.
This is good advice for anything under warranty. They are on the hook to make sure it works; let them make sure it works.
It is possible that the CPU fan/heatsink is not entirely in contact with the CPU ~this would certainly shut it down if the case... Its AMD and you say you are new with PCs, so while I'd normally suggest you check the heatsink, I would not recommend doing this on your new computer if you've never done it before; Also you should only tinker with the inside after the warranty expires ~else you almost certainly void it.
**** EDIT: After re-reading the OP, I see that you said 20 minutes (I was thinking it was 2 minutes); that would not be a heatsink issue with the CPU.
If it has never worked (you said you got it today /yesterday), send it back, and don't tinker with it.
There nothing wrong with the hardware its windows 7 because I can go on the BIOS meun and it wont restart or turn off
Possible, but possibly not. Its not doing an awful lot just idling in the BIOS. Playing around with the Ubuntu Live CD (running apps, surfing the web, running any kind of Benchmarks) could expose or disprove a few things.