No, that is technically illegal. Your AppleID purchases cannot be freely distributed by you. That person needs to purchase their own license to use that app by buying it themselves with their own AppleID. Not to mention if someone else knows your AppleID and password, they also have access to all your Apple service accounts - iCloud, FaceTime, iMessage, etc.
Family sharing allows sharing of apps as long as someone is a member of the family group. It doesn’t transfer ownership of the license though and when someone leaves a family group, they loose access to shared content until they buy it themselves. But if you’re not part of a family group you could create one and share purchases with this person -> Family Sharing - Apple