There is no standard script for this. This is very simple. Capture the script for adding a record in the form. Now try to add again with the same values. Depending on the requirement, you can change the value of different fields. Insert verification point for the message displayed due to saving and duplicacy of values.
A highly advanced bug is indistinguishable from a feature.