Can I use an old refrigerator to produce water from air
You don't need to take the fridge apart, and most people tend to break the refrigeration system when doing so, so don't. Just run it with the door open. Also leaves it in more salable condition when you tire of the science experiment.

To make it more efficient, use a new, not old, refrigeration system.

To make it easy, use a dehumidifier, which is already made to do exactly this. Or an air conditioner, which is like a dehumidifier but with the hot side placed out-of-doors - that's also where the collected water is generally drained to.

The collected water will in one sense be "pure" (it's effectively distilled) but in most others it's fairly foul (every bit of dust in the air can come along and contaminate it) so regardless of what you use, you're going to want to filter or treat  (boil, for instance) the water before using it as "potable"

Finally, this is generally not a cost-effective method of getting liquid water, unless you happen to need a dehumidifier (or air conditioner) anyway.