The setting you're trying to change is a setting that controls the behavior of the shell for the current user. If a sandbox app, like your UWP app, was able to do that then it wouldn't be much of a sandbox. The whole purpose of running an app in a sandbox in UWP is so it cannot make changes that the user doesn't authorize. Changing the taskbar alignment would be such a change.
If you need to make a shell change for the user then you're going to need to request permission for your app to do it via the registry. I'm not aware of a Win32 API to do it but even if there were then your UWP app would either not have access (because it is a sandbox) or you'd have to ask for permissions to whatever rights it is tied to.