Add codes to lineRender

I have this scipt:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class GamePlay : MonoBehaviour {
    public GameObject[] petList;
    public int maxPetCount = 40;
    public Text TimerText;
    public int GameTime = 60;
    // An ArrayList for chained pet
    private ArrayList chainedList;
    private float timeCounter;
    private bool gameEnabled = false;
        // A place to keep all created pet to, easier management
    private GameObject petHolder;
    private LineRenderer lineRenderer;
    // Use this for initialization
    void Start () {
        // Create the place holder
        petHolder = new GameObject ("Holder");
        lineRenderer = petHolder.AddComponent<LineRenderer>();
        lineRenderer.material = new Material(Shader.Find("Sprites/Default"));
        lineRenderer.SetColors(new Color(1,1,1), new Color(1,1,1));
        lineRenderer.SetWidth(0.1f, 0.1f);
        // Create the list
        chainedList = new ArrayList();
        // Move the pet creation to a function, so we can reuse it with
        // spawning different number
        Respawn (maxPetCount);
        gameEnabled = true;
        timeCounter = GameTime;
        TimerText.text = ((int)timeCounter).ToString();
    }
    // Function to create pets
    void Respawn (int count) {
        for (int i=0; i<count; i++) {
            GameObject instance = Instantiate (petList[Random.Range(0, petList.Length)], new Vector3 (Random.Range(-2.6f, 2.6f), 7.0f, -1.0f), Quaternion.identity) as GameObject;
            // put the newly pet as the child of petHolder
            instance.transform.SetParent(petHolder.transform);
        }
    }
    // Update is called once per frame
    void Update () {
        if (!gameEnabled)
            return;
        if (timeCounter > 0) {
            timeCounter -= Time.deltaTime;
            TimerText.text = ((int)timeCounter).ToString ();
        }
        if (Input.GetMouseButtonDown (0)) {
            // simulate touch began
            Vector3 p = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast (p, Vector2.zero);
            if (hit.collider != null) {
                if (hit.collider.tag == "Pet") {
                    Pet pet = hit.collider.GetComponent<Pet> ();
                    // Add the pet to the chain
                    chainedList.Add (pet);
                    // Make it selected
                    pet.SetSelected (true);
                }
            }
        }
        if (Input.GetMouseButtonUp (0)) {
            // simulate touch ended
            // Only destroy pets in the chain with count > 2
            if (chainedList.Count > 2) {
                // Loop for every pet in the chain
                foreach (Pet pet in chainedList) {
                    // Destroy it
                    Destroy (pet.gameObject);
                }
                // Call respawn function to generate new pets
                Respawn (chainedList.Count);
            } else {
                // Chain count less than 3, just make the last pet unselected
                SetChainedLastPetSelected (false);
            }
            // Clear the chain list
            chainedList.Clear ();
        }
        if (Input.GetMouseButton (0)) {
            // simulate touch moved
            Vector3 p = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast (p, Vector2.zero);
            if (hit.collider != null) {
                if (hit.collider.tag == "Pet") {
                    Pet pet = hit.collider.GetComponent<Pet> ();
                    // Check if this pet already inside the chain?
                    if (!chainedList.Contains(pet)) {
                        // Not inside the chain, is it valid to be chained?
                        if (GetLastPetInChain ().Validate (pet)) {
                            // Yes, make the last chained pet unselected
                            SetChainedLastPetSelected (false);
                            // Add to the chain
                            chainedList.Add (pet);
                            // Make it selected
                            pet.SetSelected (true);
                        }
                    } else {
                        // This pet is inside our chain, what is the index?
                        int index = chainedList.LastIndexOf (pet);
                        // Second last?
                        if (index == chainedList.Count - 2) {
                            // Backward to second last pet, unselect the last pet
                            SetChainedLastPetSelected (false);
                            // Remove the last one
                            chainedList.RemoveAt(chainedList.Count-1);
                            // Make the last pet selected
                            SetChainedLastPetSelected (true);
                        }
                    }
                }
            }
        }
        // Process at every frame no matter there are pets in the chain
        foreach (Pet pet in petHolder.GetComponentsInChildren<Pet>()) {
            pet.SetHighlight (false);
        }
                // Highlight pet if there is a pet in the chain
        if (chainedList.Count > 0) {
            HighlightValidPet (GetLastPetInChain());
            if (chainedList.Count > 1) {
                // draw a line segments for all chained pet
                lineRenderer.SetVertexCount(chainedList.Count);
                int i = 0;
                foreach (Pet pet in chainedList) {
                    lineRenderer.SetPosition(i, new Vector3(pet.transform.position.x, pet.transform.position.y, -3));
                    i++;
                }
            }
        }
        lineRenderer.enabled = chainedList.Count > 1;
    
    // A function to make the last chained pet in the list to select/unselect
    void SetChainedLastPetSelected(bool selected) {
        Pet pet = GetLastPetInChain ();
        if (pet != null) {
            pet.SetSelected (selected);
        }
    }
    // Helper to return the last pet in the chain
    Pet GetLastPetInChain()
    {
        if (chainedList.Count > 0)
            return chainedList [chainedList.Count - 1] as Pet;
        return null;
    }
    // A recursive function to highlight all valid pets around the provided pet
    void HighlightValidPet(Pet pet) {
        foreach (Pet p in petHolder.GetComponentsInChildren<Pet>()) {
            if (p.Validate (pet) && !chainedList.Contains (p)) {
                p.SetHighlight (true);
                HighlightValidPet (p);
            }
        }
    }
}
}

And according to a tutorial I have to put this:

        lineRenderer = petHolder.AddComponent<LineDot>();
        lineRenderer.LineMat = new Material(Shader.Find("Unlit/LineShader"));
        lineRenderer.DotMat = new Material (Shader.Find ("Unlit/CircleShader"));
        lineRenderer.SetColor(new Color(115/255f, 255/255f, 254/255f));
        lineRenderer.SetWidth(0.1f);

The tutorial says: Of course, our LineDot is different from LineRenderer‘s function, we have to change the created codes for lineRenderer.
Where should I add it? I have tried adding it on line 20 but it has not worked and I am a newbie to unity.

To me this looks like a duplicate post of Add codes to lineRender where people have already provided you a ton of assistance.

Wherever you got this script from, I can see that it already has some problems because it uses Shader.Find() and that will fail to operate in the final built game unless you understand precisely how to ensure those shaders are NOT stripped out.

In fact, there is almost NEVER a call to use Shader.Find(), ever. The reason is that there is no way to reason about how to prevent those shaders from being stripped out, and then you get pink materials.

The traditional way to reference materials is to make a public Material slot and drag stuff in. That will always work 100% of the time, never fail.

Beyond that, this entire script and the post referenced above feels as though you are trying to “learn all the things all at the same time” and you are doing so on an advanced procedural geometry script of dubious provenance.

I suggest instead you put this aside and step back to some basic tutorials on Unity scripting, some SUPER SUPER SUPER bog simple stuff, until you understand how Components are slotted into GameObjects and how their public properties are manipulated via script.