Try the code below for a VBA solution, once you select a few tasks (let's say 3) it will add a Summary tasks above them, and indent these 3 tasks inside.
Option Explicit
Sub AddSummayTask()
Dim t As Task
Dim i As Long
Dim RowsSelected() As Long
Dim FirstRow As Long
FirstRow = 10000
' redim the array of tasks selected to maximum size of 1000
ReDim RowsSelected(0 To 1000)
i = 0
' loop through all selected tasks
For Each t In ActiveSelection.Tasks
' add current task ID (row) to an array
RowsSelected(i) = t.ID
' check for the first row
If FirstRow > t.ID Then FirstRow = t.ID
i = i + 1
Next t
' redim array of tasks selected to actual size
ReDim Preserve RowsSelected(0 To i - 1)
' add a Task before the first selected row
ActiveProject.Tasks.Add Name:="Summary test", before:=FirstRow
' loop through all rows of selected tasks and indent them
For i = 0 To UBound(RowsSelected)
ActiveProject.Tasks(RowsSelected(i) + 1).OutlineIndent
Next i
End Sub