How to add pages in wordpress using codes?

is_page() checks if page is being displayed, it has nothing to do with checking if page exists at all in installation.

You likely want get_page_by_path() or get_page_by_title() instead.