How does a gravitational wave travel over vast distances without losing its energy? Could they go on forever as long as the Space?
The other answers skirt what I think is the issue that the OP is asking about. In a lossless medium a spherical wave packet itself, caused by a disturbance, will not "loose energy" itself. If you integrate over a large volume you get a constant energy versus time. Of course the flux per unit area will decrease by the same rate that the area increases, but that's a trivial result.
But, when gravitational waves pass matter, they really do deposit energy in the matter, and thereby become attenuated. The effect is very very tiny for a given amount of matter, but it is non-zero and the universe is pretty big.
In this answer to the question Transfer of energy from gravity back to other “more familiar” forms of energy? I've said:
This is from the Wikipedia article mentioned. I think this is really worth reading, as it not only describes some of the physics associated with the accepted answer and it's citation of Feynman's argument about a bead a stick, but perhaps gives a little insight into the development of the field as well.
Later in the Chapel Hill conference, Richard Feynman — who had insisted on registering under a pseudonym to express his disdain for the contemporary state of gravitational physics — used Pirani's description to point out that a passing gravitational wave should in principle cause a bead on a stick (oriented transversely to the direction of propagation of the wave) to slide back and forth, thus heating the bead and the stick by friction. This heating, said Feynman, showed that the wave did indeed impart energy to the bead and stick system, so it must indeed transport energy, contrary to the view expressed in 1955 by Rosen.
In two 1957 papers, Bondi and (separately) Joseph Weber and John Archibald Wheeler used this bead argument to present detailed refutations of Rosen's argument.(5)(6)
(5) Bondi, Hermann (1957). "Plane gravitational waves in general relativity". Nature 179 (4569): 1072–1073. Bibcode:1957Natur.179.1072B. doi:10.1038/1791072a0.
(6) Weber, Joseph & Wheeler, John Archibald (1957). "Reality of the cylindrical gravitational waves of Einstein and Rosen". Rev. Mod. Phys. 29 (3): 509–515. Bibcode:1957RvMP...29..509W. doi:10.1103/RevModPhys.29.509.
It's a wave, and like any other wave, it loses flux (power over area) with the square of the distance. That is, if you double the distance it travels, your wave will have a quarter of the flux it had. If you triple the distance, your wave will have a ninth of the flux it had. This is a property of waves and can be observed in light intensity, sound, and any other wave.
Technically, the wave will never fully dissipate. If the wave travels a million times the distance, the wave will weaken to one trillionth of what it was. Still not zero, but very tiny nonetheless.
In empty space, just like a light wave, they spread out, becoming less intense as they get further from their source, but never vanishing completely. At some stage the waves from a distant event might become undetectable in local noise, or so weak that quantum effects might become relevant, but essentially they never die out.
As @uhoh points out, they do lose some energy when they interact with matter.