You should yank the text to the *
or +
registers:
gg"*yG
Explanation:
gg
- gets the cursor to the first character of the file
"*y
- Starts a yank command to the register
*
from the first line, until...
- Starts a yank command to the register
G
- go the end of the file