How to build loyalty
Demonstrate your gratitude: Show the person how much you appreciate them. Express how valuable they are to you and how important their presence is in your life. Take nothing for granted. Demonstrating your loyalty to someone can encourage them to be more loyal to you.
Keep your promises: If you make promises or commitments to them, make it a point to keep them and not disappoint them. If you can't do something, be honest and upfront about it right away.
Be honest: Maintain transparency and honesty with the individual, and avoid keeping secrets from them. It's also critical to be genuine with them, even if it makes you vulnerable. Being yourself with them fosters trust and loyalty.
Address problems within the relationship: If there is a problem in your relationship, resolve it directly with the person rather than discussing it with others. This demonstrates that you respect and value the relationship with the person rather than seeking external validation by discussing them and your problems with others.
Be encouraging: When they are struggling, offer support and assist them in dealing with their issues. When difficulties arise, don't give up on them. They should know you're there for them in good times and bad.
References
1) https://www.verywellmind.com/loyalty-characteristics-benefits-and-drawbacks-5270178