how to save the session in OWASP zap using command-line on some location
session persist is possible only through UI?
If I don't save the session file explicitly and close the zap directly, then it doesn't store .session file, to open session next time in zap, I need .session file.
Yes, this is possible via the API - see here the documentation, you're looking for saveSession
operation.