Try this it works until the last line you'll have to tweak it slightly.
Option Explicit
Dim lRealLastRow As Integer
Dim lRealLastColumn As Integer
Public Sub GetRealLastCell()
Range("A1"

.Select
On Error Resume Next
lRealLastRow = Cells.Find("*", Range("A1"

, xlFormulas, , xlByRows, xlPrevious).Row
lRealLastColumn = Cells.Find("*", Range("A1"

, xlFormulas, , xlByColumns, xlPrevious).Column
Cells(lRealLastRow, lRealLastColumn).Select
End Sub
Sub insertBlankline()
Dim ls_CellValue
Dim li_RowPosition
li_RowPosition = 1
Call GetRealLastCell
Do Until li_RowPosition >= lRealLastRow
Range("A" & li_RowPosition).Select
ls_CellValue = ActiveCell.Text
If ls_CellValue = "main" Then
ActiveCell.Insert
li_RowPosition = li_RowPosition + 2
lRealLastRow = lRealLastRow + 1
'Call GetRealLastCell
Else
li_RowPosition = li_RowPosition + 1
'Call GetRealLastCell
End If
Loop
End Sub