I have ebike with 48v 20ah battery.
I want to upgrade the controller for more power.
Will 350w controller that outputs 27ah will damage the battery?
The service life of conventional lipo batteries are a function of their discharge current; the lower the better.
It's generally recoommended to keep the discharge current below 1C, where C(amps) = Ah battery rating (amps).
For your battery, discharge current should be limited to 20A for max life.
I am confused about your controller's rating of 350W, 27Ah. Controllers are normally rated at their max operating voltage (volts), max output current (amps), and sometimes max output power (watts = volts x amps). For your 48V, 20Ah battery I'd suggest a controller rated at a min of 60V, 25A, 1500W. 30A, 1800W would be even better though this will not necessarily deliver more motor power.
Note that the higher current rating on the controller (25A or 30A) does not necessairly imply that the battery will deliver this much current. This is better limited by the max motor current. A 48V, 750W motor will draw something like 16A max current, well matched to your battery. Changing the controller will not increase motor power in this example, just lower the controller operating temperature.
What are the ratings of your motor. and controller now?