The correct option is B added
When a speech is reported in its direct form (in direct speech), it is reported by someone else. The speech is now in the past, hence the tense outside that speech is usually in simple past tense. For example, 'He said, "I love olives."' where the verb 'said' is in simple past tense.
This explanation can be applied for the given sentence too, which contains quoted lines, reported by a third person: Then, __(patting) the masthead lovingly, he __ (add), "Goodbye, masthead."
Hence the correct form of 'add' here is in simple past tense, i.e., added. So, D is correct.
Option A: 'Add' is in simple present tense form.
Option B: 'Was added' is in the simple past tense but in a passive voice. The given sentence is in an active voice.
Option C: 'Had added' is in past perfect tense.
These verb forms do not express the simple past tense (active voice). Hence A, B and C are incorrect.