If you have GNU `sed`, it's fairly simple:
sed -zi '/NoDisplay=true/!s/$/\
NoDisplay=true/' file
Option `-z` treats the whole line at once in the pattern space (not recommended for huge files). If the setting is not (`!`) found, append it at the end with an embedded newline. Note: `-i`, `-z` and `\
` in the replacement string are not standard, so this is not portable.