Two small questions here:

* Why is **Subentry3** not in `\scriptsize`?
* How to arrange **... Mainentry1** so that it will only appear at the end of the last **Subentry** (however many pairs that may be), instead of at the end of the first pair (i.e. at the end of **Subentry2**)?

MWE
===

```
% !TEX TS-program = lualatexmk

\documentclass{scrreprt}

%%%%%%%%%%%%%%%%%%%%%%
%
%
%
\newenvironment {mainentry} {\mainentryA}{}
\def\mainentryA#1#2#3{%
   \def\subentry##1##2{%
\scriptsize ##1 \space \Huge ##2 ... #1
   }%
#1 #2 #3
}
%
%
%
\def\subentry{\def\subentryS{\def\subentryS{\endgraf}}\futurelet\next\subentryA}
\def\subentryA{\ifx\bgroup\next\expandafter\subentryB\fi}
\def\subentryB#1#2{\subentryS\subentry{#1}{#2}\futurelet\next\subentryA}
%
%
%
%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{mainentry}{
Mainentry1
}{
Mainentry2
}{
Mainentry3
}

\subentry{
Subentry1
}{
Subentry2
}{
Subentry3
}{
Subentry4
}

\end{mainentry}

\end{document}

```