I was trying to save my path coordinates as a list. But when i was trying to print the list of points, got errors "unbound variable-plist" . the code is mentioned below.
Not clear what your problem is now - please elaborate. You have four separate functions there, which are variously referring to global variable. For example, nvGetLocation is referring to a variable n which would need to be defined. nvMyDirection is referring to global variable p_list (which is not the same as the variable p_list in nvGetMyLocation, since that is local to the prog() call within that function).
So what are you calling, and what is happening that is not what you expect?