MacOS File Permissions Reset After Writing
What you need is to change the permissions of the folder containing the file. Better to use the Terminal for that.

First, set the group of the folder to me (the same group as your two users)

chown :me /Users/Shared


Second, set the SetGID bit of the folder

chmod g+s /Users/Shared


Now, when KeyPass will modify the database, it will stick with the group you defined on your folder.

As a bonus, any new file in the Shared folder will automatically belong to that same group.