Hello Subhash,
You can take two local variable for password and confirm password, once user enter both the input fields then on click of the button you can check in If condition that Trim(Password Variable) = Trim(Confirm Password Variable ) If it is true then perform you further action, if it is false then show error message that password and confirm password doesn't match.
Something like this:-

Hope it helps you.
Regards,
Pavan R