It sounds too simple to be true, but try it and you’ll be a convert.
Note: all cans of refried beans are different in taste and texture. Use your judgment when adding liquid and other dairy. If your beans aren’t “stiff” when taken out of the can, they may need less liquid. I suggest if in doubt, start with a little less and add more bit by bit.
If your refried beans turn out too thin for your taste, continue to heat, stirring as needed, until they thicken up. It may take a few minutes, but they will thicken with patience and care. They will be a tiny bit thicker as they cool from molten hot off the stove.
Add butter, lard or bacon drippings to pan and heat over medium heat. Add in can of refried beans, including any liquid. Stir together.
When warmed through, add the dairy and continue to heat, stirring now and then, until desired thickness is reached, a minute or two.
Do see above note on the texture.
Find it online: https://frugalhausfrau.com/2015/04/30/canned-refried-beans/