There’s a ready-made script for that in the documentation chapter "Scripting —> Accessing an Output Database —> Using the Abaqus Scripting Interface to access an output database —> Example scripts that access data from an output database —> Finding the maximum value of von Mises stress".