Hello, I can certainly understand how frustrating it is when your device is not working as designed. This article provides some steps that may help with the phone unexpectedly powering off. https://www.samsung.com/us/support/troubleshooting/TSG01002035/
If the phone continues to power off, it is recommended to have the phone evaluated at an authorized service center. You can use the following link to find a list of service centers in the U.S. that can do the repair: http://www.samsung.com/us/support/service/location or by contacting customer support at 1-800-726-7864.
For assistance outside the U.S., please use this link: https://www.samsung.com/us/common/visitlocationsite.html