Solution 1 :

You can use jQuery insertAfter for doing this.
Moreover you need to set the event on document, since the buttons are not existing on initialization but created dynamically.

var filterTableNum = 0;
$('.add-table').click(add_empty_table);
$(document).on('click', '.btwn-table', add_table_between);

function create_table() {
    const originTable = document.getElementById('source-table');
    let newTable = originTable.cloneNode(true);
    newTable.id = 'source' + ++filterTableNum;
    newTable.querySelectorAll('input').forEach((element) => {
        element.value = '';
    });
    $(newTable).find('.component-id').val(newTable.id);
    return $(newTable);
}

function add_empty_table() {
    let newTable = create_table();
    $('#main-div').append(newTable);
}

function add_table_between(e){
    let newTable = create_table();
    let originTable = $(e.target.closest('table'));
    newTable.insertAfter(originTable);
}
#container>table{
display:none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button class="add-table">
        Add Table
      </button>
<div id="container">     
<table
          id="source-table"
          data-component-type="Source"
          class="component-base table table-responsive table-striped rounded"
        >
          <thead class="thead-dark">
            <tr>
              <th colspan="6" class="text-center">
                <span>Source : </span
                ><input
                  id="id"
                  type="text"
                  name="id"
                  placeholder="id"
                  class="component-id form-control-head"
                />
                <button
                  class="delete-component btn btn-danger"
                  style="margin: 1%;"
                >
                  Delete Table
                </button>
              </th>
            </tr>

            <tr>
              <th scope="row">Type</th>
              <th scope="row">Name</th>
             
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>
                <input
                  id="type"
                  type="text"
                  name="type"
                  class="form-control"
                  placeholder="Type"
                />
              </td>
              <td>
                <input
                  id="Name"
                  type="text"
                  name="name"
                  class="form-control"
                  placeholder="Name"
                />
              </td>
            </tr>
          </tbody>
          <tfoot>    
            <tr>
            <td>
            <button class="btwn-table">Add Table Here</button>
           
            </td>
          </tr>
        </table>
        
 <div class="main-div" id="main-div"></div>

Problem :

how to add table in between any two of the table, Currently i’m able to add the table in append mode which is add the table at the end i.e. <div id="main-div">!
So there is button in base table in <tfoot> is add table here if user click on that button table should be added after table on which table button gets clicked.

For Example :

I have created 5 tables out of which i want add one more table after
3rd table so if i click on add table here button then table should
be get added at the 4th position not at the end.

any suggestion ?any solution

var filterTableNum = 0;
$('.add-table').click(add_empty_table);

function add_empty_table() {
    const originTable = document.getElementById('source-table');
    let newTable = originTable.cloneNode(true);
    newTable.id = 'source' + ++filterTableNum;
    newTable.querySelectorAll('input').forEach((element) => {
        element.value = '';
    });
    $(newTable).find('.component-id').val(newTable.id);
    $('#main-div').append(newTable);
    
}

function add_table_between(){

}
#container>table{
display:none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button class="add-table">
        Add Table
      </button>
<div id="container">     
<table
          id="source-table"
          data-component-type="Source"
          class="component-base table table-responsive table-striped rounded"
        >
          <thead class="thead-dark">
            <tr>
              <th colspan="6" class="text-center">
                <span>Source : </span
                ><input
                  id="id"
                  type="text"
                  name="id"
                  placeholder="id"
                  class="component-id form-control-head"
                />
                <button
                  class="delete-component btn btn-danger"
                  style="margin: 1%;"
                >
                  Delete Table
                </button>
              </th>
            </tr>

            <tr>
              <th scope="row">Type</th>
              <th scope="row">Name</th>
             
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>
                <input
                  id="type"
                  type="text"
                  name="type"
                  class="form-control"
                  placeholder="Type"
                />
              </td>
              <td>
                <input
                  id="Name"
                  type="text"
                  name="name"
                  class="form-control"
                  placeholder="Name"
                />
              </td>
            </tr>
          </tbody>
          <tfoot>    
            <tr>
            <td>
            <button class="btwn-table">Add Table Here</button>
           
            </td>
          </tr>
        </table>
        
 <div class="main-div" id="main-div"></div>

JS Fiddle : https://jsfiddle.net/shreekantbatale2/krnpfw36/1/

By