JSFiddle - React, Tailwind, and code Playground

HTML

<body>
    <input type="text" id="test" onclick="createLines()">
</body>

JavaScript

var stateOfClick = null;

function initiateLine(){
    document.getElementById('test').value = "Started";
}

function endLine(){
    document.getElementById('test').value = "Line Ended";
}

function createLines(){
  if(!stateOfClick) {
    initiateLine();
    stateOfClick = 1;
  } else {
    endLine();
  }
}