Exceeding speed limit with Ebike, is battery affected? I bought a ebike and happy with it. My 30 mins ride to work every day dropped to 15 mins.

But according to law in country where I live motor stops when I exceed the speed limit which is 25km/h. 

Since I am using ebike just for assistance I am pedaling as well. But most probably I am dropping below 25km/h(very often) and motor is being on again(or is it?).

I wanted to ask how this being on-off frequently(which can be my rich imagination) situation effects the life of the battery?
Actually, when you are running the motor near the top of the speed limiter, it's the happiest and most likely drawing the least current. If you had a CycleAnalyst or other amp gauge, you'd see it reduce current as it reaches the point where the controller is turning it off to reduce the speed. The motor will be cutting in and out due to the limiter, but will otherwise be just fine with this regimen as it's effectively operating on a reduced duty cycle at full speed - optimal conditions. This is quite unlike internal combustion engines which don't like to be operated at the highest end of their RPMs.

Furthermore, when you're running at full speed, air cooling to the controller, battery, and the motor is at its maximum, so they're at their happiest thermally.

The hardest thing on an electric motor, controller, and battery is starting up from a dead stop and going slowly up a hill. This is when the motor requires the most torque and thus draws the most amps - but also has the least airflow - which means everything heats  up and potentially reduces their life.

As I noted in my comments, though, the best way to extend the life of your (presumably) lithium batteries is to not drain them to 0% and to also not charge them to 100% -- but for the latter, you'll need a charger with an 80% or 90% cutoff. These are sold on the after-market. With careful dis/charging practice you can extend the number of charge cycles from 300 cycles to 900 or more.