Add a specific text and variable

The trick here is to change the content of command \location to

\setkomavar{location}{%
  \\[\baselineskip] \\[\baselineskip]
  \flushright\small Rechnungsnummer: \invoiceReference\\[1pt]
  Kundennummer: \customerNumber
}

I added the line Kundennummer: \customerNumber which means you have to add a new command \customerNumber to the datas for your customer(s). It is better to use a command that writing it each time you write an invoice new. It gives you less errors.

But now you have to define this command like:

 \newcommand{\customerNumber}{1234567} % Kundennummer

Best solution would be to define two new commands like

 \def\invoicenr{Rechnungsnummer:}%
 \def\customernr{Kundennummer:}%

to make your invoice more language independent (off course you need then to define this words for the other languages too). Then you can use

\setkomavar{location}{%
  \\[\baselineskip] \\[\baselineskip]
  \flushright\small \invoicenr \invoiceReference\\[1pt]
  \customernr \customerNumber
}

To avoid the splitting of Rechnungsnummer: and current number you can use shorter Names like

 \def\invoicenr{Rechnungsnr.:}%
 \def\customernr{Kundennr.:}%

With the complete code (based on your last question with the described changings above)

\documentclass[a4paper]{scrlttr2}

\usepackage[top=2cm, bottom=1cm, left=2cm, right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{color}
\usepackage[hidelinks]{hyperref}

\usepackage[german]{invoice}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\def\UnitDay            {Preis/Tag}% <========================================

\newcommand{\FeeDay@Title}{% <==========================================
    \\
    \noindent\textbf{\Activity}&&\UnitDay&\Count&\Amount\ (\BC)\\
    \hline%
}%

\newcommand{\FeeDay}[3]{% Yields state 3, Print Fee Item <==============
    %
    % #1 Contents
    % #2 Fee per Day
    % #3 Unit Count
    %
    \ifcase\Flag % 0: Invoice not started yet
        \error@message{\MissingOpening}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 1: Start invoice
        %
        \error@message{\MissingProject}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 2: Start project, print title
        %
        \FeeDay@Title%
        \Fee@Line{#1}{#2}{#3}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 3: Print remuneration item
        %
        \Fee@Line{#1}{#2}{#3}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 4: Print subtotal remuneration
        %
        \warning@message{\FeeSTExists}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 5: Expense item
        %
        \error@message{\FeeBeforeExpense}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 6: Print subtotal expenses
        %
        \error@message{\FeeBeforeExpense}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 7: Print subtotal project
        %
        \error@message{\ProjectCompletedNoFee}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 8: Print total, close invoice
        %
        \error@message{\InvoiceCompletedNoFee}%
        %
        %
    \else \error@message{\InternalError}%
    \fi%
}%
\makeatother


\renewcommand{\familydefault}{\sfdefault}

% include meta data
\include{_data} % <============== delete in this file the following data!
% ################## invoice DATA ##################
\newcommand{\invoiceDate}{DD.MM.YYYY} % Datum der rechnungsstellung
\newcommand{\payDate}{DD.MM.YYYY} % Datum der Zahlungsfrist
\newcommand{\invoiceReference}{20150122-4} % Rechnungsnummer (z.B. 20150122-4) YYYYMMDD-1
\newcommand{\invoiceSalutation}{Sehr geehrte Damen und Herren,} % die Anrede
\newcommand{\invoiceText}{Für die von mir erbrachte Leistung erhalten sie
hiermit die Rechnung. Bitte zahlen Sie den unten aufgeführten Gesamtbetrag
unter Angabe der Rechnungsnummer (\invoiceReference) bis
zum \payDate \ auf das angegebene Konto ein.} % Rechnungstext
\newcommand{\invoiceEnclosures}{} % \encl{} einfügen
\newcommand{\invoiceClosing}{Mit freundlichen Grüßen}
% ################## invoice DATA ##################

% ################## Customer DATA ##################
\newcommand{\customerCompany}{Firma XYZ} %ggf. Firma
\newcommand{\customerName}{Max Mustermann} % Name
\newcommand{\customerStreet}{Robert-Koch-Str. 12} % Straße
\newcommand{\customerZIP}{12345} % Postleitzahl
\newcommand{\customerCity}{Musterstadt} % Ort
\newcommand{\customerNumber}{1234567} % Kundennummer <==================
% ################## Customer DATA ##################

\setkomavar{fromname}{\senderName}
\setkomavar{fromaddress}{\senderStreet \\ \senderZIP \ \senderCity}
\setkomavar{place}{\senderCity}
\setkomavar{date}{\invoiceDate}
\setkomavar{fromphone}{\senderTelephone}
\setkomavar{frommobilephone}{\senderMobilephone}
\setkomavar{fromemail}{\href{mailto:\senderEmail}{\nolinkurl{\senderEmail}}}
\setkomavar{subject}{Rechnung}

\def\invoicenr{Rechnungsnr.:}% <========================================
\def\customernr{Kundennr.:}%

\setkomavar{location}{%
      \\[\baselineskip] \\[\baselineskip]
      \flushright\small \invoicenr \invoiceReference\\[1pt] % <=========
      \customernr \customerNumber
    }


\setkomavar{firsthead}{\hfill
   \parbox[t][\headheight][t]{7cm}{% 
   \footnotesize
   \raggedright
   \flushright
   \color[gray]{.3}%
    \begin{tabular}{rl}
         Anschrift & \usekomavar{fromname}\\
         & \senderStreet\\
         & \senderZIP  \ \senderCity \\
         \\
         %\Telefon \ Telefon:  \` \senderTelephone \\
         Mobil  & \usekomavar{frommobilephone} \\
         E-Mail  & \usekomavar{fromemail} \\
         Webseite & {\normalfont\ttfamily  \senderWeb } \\
         \\
         Steuernummer & \taxID \\
         \\
         Institut & \accountBankName \\
         IBAN & \accountIBAN \\
         BIC & \accountBIC
    \end{tabular}                   
   }%
}


\begin{document}
    \begin{letter}{\customerCompany \\ \customerName \\ 
    \customerStreet \\ \customerZIP \ \customerCity}

            \includegraphics[width=0.15\textwidth]{logo.png}            
            \opening{\invoiceSalutation}
            \invoiceText
            \begin{invoice}{Euro}{0}
\ProjectTitle{Projekttitel} % 
\Fee{Musterdienstleistung 1}{30.00}{4}
\Fee{Musterdienstleistung 2}{36.00}{7}
\ProjectTitle{Tagesleistungen} % 
\FeeDay{Musterdienstleistung 3}{360.00}{3}

% Auslagen
%\EBC{Hotel, 12 Nächte} {2400.00} % \EBCi{Hotel, 12 Nächte} {2400.00}
%\STExpenses

% Rabatt
\Discount{Rabatt} {20} % 
            \end{invoice}
        \ps Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer 
        enthalten.

        \closing{\invoiceClosing}
        \invoiceEnclosures



    \end{letter}
\end{document}

you get the result:

enter image description here

If you want Kundennummer and rechnungsnummer and the relevant numbers to be one below the other simply change \location to

\setkomavar{location}{%
      \\[\baselineskip] \\[\baselineskip]
      \flushright\small \invoicenr\\[1pt] \invoiceReference\\[1pt] % <=========
      \customernr\\[1pt] \customerNumber
    }

with the result:

enter image description here

Please see that you can use

\newcommand{\invoiceReference}{2019\_01\_14\_01}

to generate an invoice reference number 2019_01_14_01 but I would not recommend that. Better use 2019-01-14-01 ...


You could just use a tabular environment with two lines for the reference:

\documentclass[a4paper]{scrlttr2}

\usepackage[top=2cm, bottom=1cm, left=2cm, right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{color}
\usepackage[hidelinks]{hyperref}

\usepackage[german]{invoice}

\newcommand\senderName{Foo Bar}
\newcommand\senderStreet{Foo Street}
\newcommand\senderZIP{12345}
\newcommand\senderCity{Bar City}
\newcommand\senderMobilephone{0123 3456789}
\newcommand\senderEmail{[email protected]}
\newcommand\taxID{4654TE132E}
\newcommand\accountBankName{MyBank}
\newcommand\accountIBAN{DE12 3456 7890 1234 5678 90}
\newcommand\accountBIC{ABCDEFG0HIJ}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\def\UnitDay            {Preis/Tag}% <========================================

\newcommand{\FeeDay@Title}{% <==========================================
    \\
    \noindent\textbf{\Activity}&&\UnitDay&\Count&\Amount\ (\BC)\\
    \hline%
}%

\newcommand{\FeeDay}[3]{% Yields state 3, Print Fee Item <==============
    %
    % #1 Contents
    % #2 Fee per Day
    % #3 Unit Count
    %
    \ifcase\Flag % 0: Invoice not started yet
        \error@message{\MissingOpening}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 1: Start invoice
        %
        \error@message{\MissingProject}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 2: Start project, print title
        %
        \FeeDay@Title%
        \Fee@Line{#1}{#2}{#3}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 3: Print remuneration item
        %
        \Fee@Line{#1}{#2}{#3}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 4: Print subtotal remuneration
        %
        \warning@message{\FeeSTExists}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 5: Expense item
        %
        \error@message{\FeeBeforeExpense}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 6: Print subtotal expenses
        %
        \error@message{\FeeBeforeExpense}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 7: Print subtotal project
        %
        \error@message{\ProjectCompletedNoFee}%
        %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \or % 8: Print total, close invoice
        %
        \error@message{\InvoiceCompletedNoFee}%
        %
        %
    \else \error@message{\InternalError}%
    \fi%
}%
\makeatother


\renewcommand{\familydefault}{\sfdefault}

% include meta data
\include{_data} % <============== delete in this file the following data!
% ################## invoice DATA ##################
\newcommand{\invoiceDate}{\today} % Datum der rechnungsstellung, change `\today' to a different  date, if you do not    want to use todays date
\newcommand{\payDate}{DD.MM.YYYY} % Datum der Zahlungsfrist
\newcommand{\invoiceReference}
  {%
    \begin{tabular}[]{@{}r@{}}
      2019\textunderscore01\textunderscore14\textunderscore1\\
      MyCustomer123%
    \end{tabular}%
  } % Rechnungsnummer (z.B.  20150122-4)
\newcommand{\invoiceSalutation}{Sehr geehrte Damen und Herren,} % die Anrede
\newcommand{\invoiceText}{folgende Positionen werden in Rechnung gestellt:} % Rechnungstext
\newcommand{\invoiceEnclosures}{} % \encl{} einfügen
\newcommand{\invoiceClosing}{Mit freundlichen Grüßen}
% ################## invoice DATA ##################

% ################## Customer DATA ##################
\newcommand{\customerCompany}{Firma XYZ} %ggf. Firma
\newcommand{\customerName}{Max Mustermann} % Name
\newcommand{\customerStreet}{Robert-Koch-Str. 12} % Straße
\newcommand{\customerZIP}{12345} % Postleitzahl
\newcommand{\customerCity}{Musterstadt} % Ort
% ################## Customer DATA ##################

\setkomavar{fromname}{\senderName}
\setkomavar{fromaddress}{\senderStreet \\ \senderZIP \ \senderCity}
\setkomavar{place}{\senderCity}
\setkomavar{date}{\invoiceDate}
\setkomavar{fromphone}{\senderTelephone}
\setkomavar{frommobilephone}{\senderMobilephone}
\setkomavar{fromemail}{\href{mailto:\senderEmail}{\nolinkurl{\senderEmail}}}
\setkomavar{subject}{Rechnung}
\setkomavar{location}{
  \\[\baselineskip] \\[\baselineskip]
  \flushright \small {\vspace{1cm}Rechnungsnummer: 
  \invoiceReference}
}

\setkomavar{firsthead}{\hfill
   \parbox[t][\headheight][t]{7.2cm}{
   \footnotesize
   \raggedright
   \flushright
   \color[gray]{.3}%
    \begin{tabular}{rl}
         Anschrift & \usekomavar{fromname}\\
         & \senderStreet\\
         & \senderZIP  \ \senderCity \\
         \\
         %\Telefon \ Telefon:  \` \senderTelephone \\ %<===================  remove the `%' and go into `_data.tex' and     add an phone number
         Mobil  & \usekomavar{frommobilephone} \\
         E-Mail  & \usekomavar{fromemail} \\
         %Webseite & {\normalfont\ttfamily  \senderWeb } \\ %<===================  remove the `%' and go into   `_data.tex' and add an URL
         \\
         Steuernummer & \taxID \\
         \\
         Institut & \accountBankName \\
         IBAN & \accountIBAN \\
         BIC & \accountBIC
    \end{tabular}                   
   }%
}


\begin{document}
    \begin{letter}{\customerCompany \\ \customerName \\ 
    \customerStreet \\ \customerZIP \ \customerCity}

            \opening{\invoiceSalutation}
            \invoiceText
            \begin{invoice}{Euro}{0}

\ProjectTitle{Tagesleistungen} % <====================================== Tagesleistungen
\FeeDay{Freelance Arbeit}{300.00}{15}

\ProjectTitle{Projekttitel} % <========================================= Stundenleistungen
\Fee{Überstunden}{30.00}{2}




%Auslagen % <=================================================Auslagen
%\EBC{Hotel, 12 Nächte} {2400.00} % \EBCi{Hotel, 12 Nächte} {2400.00}
%\STExpenses

% Rabatt
\Discount{Rabatt} {0} % <========================================== Rabatt
            \end{invoice}
    \ps Bitte überweisen Sie den Rechnungsbetrag auf das unten aufgeführte Konto. 
    \ps Kleinunternehmerregelung: Im ausgewiesenen Betrag ist gemäß § 19 UStG keine Umsatzsteuer enthalten.

        \closing{\invoiceClosing}
        \invoiceEnclosures



    \end{letter}
\end{document}  

enter image description here