At that time of night taxi may be your best but most expensive option, about $100 with tip. Most of the shuttle buses don't run that late. The E subway or LIRR (take Airtrain from your terminal to Jamaica Station for either) run 24/7 which you could take to Penn Station, then NJ Transit or Amtrak to Newark Airport rail station and then the Newark Airport Airtrain from there to terminals, about $25-$30.
At that time of night taxi