You can believe me that I would really prefer to use the operating system tools for changing passwords but I didn't figure out how to use them (I have passwd without --stdin or something else)!
This script will be run in our intranet, not on the internet! But of course, I have planned to implement a password validation (for problems like ".*").
Thanks for the hint to work with a shadow.temp file. This makes this a bit saver than it is designed now.