What is the purpose of a nuclear reactor?

To produce heat. The heat may be used, in one form or another, to generate electricity (steam, for example).