You can use an awk
script to do this as shown below:
pax> echo '<Tariff>
<AA>10030</AA>
<AA>100</AA>
</Tariff>
<Tariff>
<AA>30004</AA>
<AA>30001</AA>
</Tariff>
<Tariff>
<AA>Account division</AA>
<AA>AIR</AA>
<AA>AA</AA>
<AA>10039</AA>
</Tariff>' | awk '
{
if ($0=="</Tariff>") {
printf "</Tarrif>\n"
} else {
printf $0","
}
}'
<Tariff>,<AA>10030</AA>,<AA>100</AA>,</Tarrif>
<Tariff>,<AA>30004</AA>,<AA>30001</AA>,</Tarrif>
<Tariff>,<AA>Account division</AA>,<AA>AIR</AA>,<AA>AA</AA>,<AA>10039</AA>,</Tarrif>
That's the nicely formatted version, the quick version is:
awk '{if ($0=="</Tariff>") {printf "</Tarrif>\n"} else {printf $0","}}' infile
Keep in mind this is a specific solution to your input file format. XML files should generally be handled with tools specific to the job since quick'n'dirty solutions will break when the input format changes (for example, if your end tags aren't on a line of their own with no spaces either side, or if you have a sinfle line containing two tariff sections).
However, if your input file format is limited as you describe, a quick'n'dirty solution will often be faster than trying to learn how to use XML transformation tools. It sometimes depends on whether you want the job done right, or done right now.