How to use the same code for multiple pages?

Please show us your actual code, and don’t just describe what you implemented. In this particular case, it is vital to see how you tried to implement two occurrences of the code.

Anyway, from what I understand, the following function should do what you’ve asked for:

add_action('wp_trash_post', 'wpse_136052_do_not_delete');
function wpse_136052_do_not_delete($id) {
    if (in_array(get_post($id), array(
        get_page_by_title('About'),
        get_page_by_title('Other Page'),
        get_page_by_title('Third Page'),
    )))
        die('You are not allowed to delete this page');
} // function wpse_136052_do_not_delete