How to share a game created with the free version of Game Maker Studio 2?

Your current problem with creating executables is due to the licence you’re using, not (necessarily) the UWP export configuration.

The Free license for GameMaker Studio 2 gives you full access to the IDE (i.e. usage and assets limitations were removed) and lets you use the application for testing and learning purposes. You can’t build game executables and share them with other people though.

This is the Free license description from the YoYo Games website:

Free

GameMaker Studio 2
Unlimited access to the IDE (integrated development environment) and learning materials.

When you export a project, GMS2 creates an exact copy of the project–which includes ALL assets, configuration files and local settings–in a directory of choice. This way, you can ‘clone’ a game project without the need to manually browse and copy/paste all files, some of which may be unnecessary (e.g. IDE temp files).

If you want to share the game with fellow developers, the above is the way to go. But, if you want to release the game for others to play, that’s a different matter. You will need an Indie or Enterprise licence, for they include what they call Desktop/Web/Mobile ‘exports’ but are actually platform-specific build plug-ins.

According to the YoYo Games website, the cheapest license you can get is:

Indie

GameMaker Studio 2
Unlimited access to the IDE (integrated development environment) and learning materials.
Desktop Exports
Windows, macOS, and Linux platforms exports.
Web Export
HTML5 platform export.
Mobile Exports
iOS, Android, Amazon Fire, Android TV, and tvOS platforms exports.
UWP Export
Universal Windows Platform (includes Xbox One Creators program) exports.