Can I keep the dog?
why do you want to keep this dog?
Because I took care of the dog for so many years
I totally understand you want to keep him after taking care of him for so long, which was a lovely thing to do.  However, if he's not yours you need to give him back.  Try and ask to visit from time to time?
The dog is with my family, I made them promise to call me anytime and let me know when it dies so I can bury it.
It's nice to see how much you care  for this dog. I'm sure he's going to miss you always. Anyway It's with your family so I bet you'll get to see him occasionally.