Saving the “best” chckpoint is usually done by checking the validation metrics and selecting the model state with the highest val metric or lowest val loss. It’s not depending on the actual use case (e.g. binary classification, regression etc.).
I don’t know how the output is created, as it seems you are running multiple epochs for the validation, while you would calculate the validation accuracy/loss once per epoch.