Hi
I am a beginner in using arduino board and I am trying to connect it with the l298n module. The problem is that I am not sure what type of battery should I use. If I choose to use a 9V battery will that damage the circuit. Because I have seen that the boards should be connected in the 5V port. Does this matter?
If you are using this module: https://www.sparkfun.com/products/9670
A plain 9v battery will not be of much use since it is for driving motors and a standard small 9v battery just does not have the capacity - the module does seem to have a 5vdc output that could be used to power your Arduino if you go in on the proper pin.
I would get a battery pack around 7.5 volts or so - I use a 5 cell AA NiMH rechargeable battery pack since I have a large number of the rechargeable AA batteries for other uses - so all I needed to do was get the battery carrier
L298N implies motor of sorts.
Get a battery that can supply the current your motors need.
As you're using an L298N, remember you're losing about 2V there and then. So if your motors need 9V, you have to supply 11V by battery. Use a more modern H-bridge such as the tb6612fng for same current specs, similar price, much smaller (no heat sink!), and much less voltage drop.
For the batteries: use a number of LiPo 16850 cells. Two of them give 7.2V, great for small motors and can power an Arduino directly through the Vin pin.
Three batteries give 11.9V, so that makes up for the losses in your H-bridge. If you want to use the same batteries for the Aruino it's better to use a buck converter to get down to the 5V the Arduino needs.
Note that you can easily use a higher voltage than the motors are rated for, as you can use PWM to limit the average current. So 12V on a 9V motor is fine as long as you don't go over 75% duty cycle. Of course if using the L298N you can higher as the H-bridge itself takes care of 2V of the supply.