How to store wordpress title in a variable

You’re example is totally unclear. What is ngegrab, what is $unity, $yesPage and what do you mean with “WordPress title”? Short: what are you trying to do exactly?

To get the title of a post, use get_the_title() as mentioned in the other answer. To get the document title (<title></title>), use wp_get_document_title().