To the importance of analyzing and describing a problem properly to find a proper solution.
Here I implement exactly what you ask for:
#!/usr/bin/env sh
for oldname
do
# Capture old file name extension for re-use, by trimming-out the leading
# characters up-to including the dot
extension=${oldname##*.}
# Capture the old name without extension
extensionless=${oldname%.*}
# Compose new name by printing the old file name
# up to its length minus 16 characters
# and re-adding the extension
newname=$(
printf '%.*s.%s\n' $((${#extensionless}-16)) "$extensionless" "$extension"
)
# Demonstrate rename as a dummy
echo mv -- "$oldname" "$newname"
done
Works for your sample case:
mv -- KUD_1234_Abc_DEF_9055_01.pdf KUD_1234.pdf
Will collide not rename this:
mv -- KUD_1234_ooh_fail_666_02.pdf KUD_1234.pdf
Will not work with names shorter than 16 characters:
mv -- notwork.pdf notwork.pdf
Will probably not do what you expect if name has no dot extension:
mv -- foobar foobar.foobar