There’s a shuttle bus service between the New York and New Jersey airports. That’d be the easiest and cheapest (in terms of reasonable solutions).
https://www.nycairporter.com/ourservices/laguardia-to-newark-airport/
Note that traffic in the NYC area can be unpredictable especially if there are road closures due to visiting dignitaries. You should plan to arrive at least an hour before your LGA flight leaves, if not more.
I’d personally get to your destination as soon as you can, check your bags in, pass through TSA, and then use your spare time to find a good place to eat in the terminal, although the terminals in LGA aren’t as bountiful in terms of places to eat as EWR. But I tend to be anxious about traveling and arrive early so take that advice with a grain of salt.
Re: If you can’t buy and print the bus ticket ahead of time. From their FAQ, you can buy tickets from one of their airport agents if you didn’t order them online:
Bus tickets can also be purchased at any NYC Airporter bus stops in Manhattan and at the Airports. Please look for our NYC Airporter counter and uniformed sales agents at the Ground Transportation Welcome Center; and, outside of Baggage Claim. You may also dial 46 from the phone boards located in the Ground Transportation Welcome Center.
Note for cheapskates that it is possible to take public transportation (a bus) from Newark airport to Port Authority in Manhattan. Then take the subway to Roosevelt Ave and then switch to another bus. This will take at least 2 hours and involves going through the 5th level of Hell known as Port Authority Station (LGA itself is on the third level). I wouldn’t recommend it unless you have absolutely no luggage except a backpack, some change — ie coins and single dollar bills in US currency (buses won’t give you any change) and a high tolerance for stress and confusion. But if you absolutely have to get a selfie at Times Square, which is in walking distance if you don’t have luggage, it’s a possibility.
Note if you’re rich you could take an Uber or Lyft from EWR to LGA. It should cost roughly $70-120 in 2018 dollars, plan for the higher side of that amount plus tip. This has the advantage that you can ask the driver to briefly stop for a slice of Ray’s pizza in Manhattan.