I had some old milk in the fridge that smells like it’s on the edge. I decided to make yogurt with it. While I was heating it, lots of curds started to form. Is it safe to eat the yogurt that I’m making with it?
I wouldn’t. If the milk curdled, it’s a sign of spoilage and the very last thing you want to do now is keep it in a warm environment for a prolonged time.
And while many yogurt recipes include a pasteurization step where you heat the milk to near boiling (not all do, btw.), this will not turn clearly unsafe milk (as indicated by the curdling) into a base for a new product. Especially if the process includes a fermentation at warm temperatures for many hours.
A typical process of making tvorog (Russian cottage cheese) is letting the milk go slightly sour (producing soured milk, as mentioned in the comments), then heating up so that it curdles, finally pressing the remains of the liquid out.
Sounds like you accidentally followed these steps. It's unlikely that at this point you can make yogurt, because much of the lactose has already been used up by other bacteria (which may be unsafe anyway).
UPD: for safety reasons, if you do make your own soured milk, use a starter culture.