Can I use these replacement ballast even though the yellow wires are on the opposite end?
If you live in the USA, that's a perfectly fine ballast for your purposes, Lori. Some manufacturers bring the yellow wires out the same end, some bring them out the opposite end. That ballast is rated to handle two 40W T12 tubes.

If you live in a country with 240V municipal power, though, that ballast won't work for you; it's built to be connected only to the 120V common in the USA.