Can I replace the crank on a Raleigh m20 with one from a Schwinn Ranger? I have a Raleigh m20 mountain bike with a messed up crankset.

The only other crankset I have is from a Schwinn Ranger. The two cranksets look like they are the same size. Is it possible to install the other crankset on the Raleigh or will I encounter any problems doing so?
If they're both the same interface, then it should be okay.

There's a fair chance they're both square taper, so you'll need a 14mm socket and a puller to get the good crank off.  

You might have problems with the chain line, and the front derailleruerueure will need aligning.

How did you mess up the crank on the raleigh originally?

How's your bottom bracket?  While the crank is off you may as well service it.