Animate lineMesh using mesh position and direction

I am drawing a line to display the direction that a cube is facing like a “raycast” while the cube is also rotating. Mine seems to go off sync “exponentially” with time. Am I doing this right? How can I best achieve this?

import * as THREE from "./three.js-master/build/three.module.js";
import { OrbitControls } from "./three.js-master/examples/jsm/controls/OrbitControls.js";

const renderer = new THREE.WebGLRenderer({antialias: true});
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(window.devicePixelRatio);

document.body.appendChild(renderer.domElement);

const camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1.0, 1000);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xaaaaaa);

const orbit = new OrbitControls(camera, renderer.domElement);

orbit.update();

const geo = new THREE.BoxGeometry();
const mat = new THREE.MeshBasicMaterial({color: 0xff0000, wireframe: true});
const mesh = new THREE.Mesh(geo, mat);

const geo_2 = new THREE.BoxGeometry(15, 0.001, 10);
const mat_2 = new THREE.MeshBasicMaterial({color: 0x0000ff, wireframe: false});
const mesh_2 = new THREE.Mesh(geo_2, mat_2);

scene.add(mesh);
scene.add(mesh_2);

camera.position.z = 0;
camera.position.y = 10;
camera.lookAt(mesh.position);

//mesh.rotation.y = 0.25;
mesh_2.position.y = -0.5;

let direction = new THREE.Vector3(0, 0, 1);

const matrix = new THREE.Matrix4();

matrix.extractRotation(mesh.matrix);

direction = direction.applyMatrix4(matrix);
direction.normalize();
//console.log("direction:", direction);

//raycaster.set(mesh.position, direction.multiplyScalar(0.5));

let points = [mesh.position, direction.multiplyScalar(1.0)];

const lineGeo = new THREE.BufferGeometry().setFromPoints(points);

const lineMesh = new THREE.Line(lineGeo, new THREE.MeshBasicMaterial({color: 0xffff00}));

let degree = 0;
scene.add(lineMesh);
function changeLine(mesh){
  if (mesh !== undefined) {
      degree += 0.05;
      mesh.rotation.y = Math.PI * degree;
      matrix.extractRotation(mesh.matrix);
      direction = direction.applyMatrix4(matrix);
      direction.normalize();
      //raycaster.set(mesh.position, direction.multiplyScalar(1.0));
      points = [mesh.position, direction];
      lineMesh.geometry.dispose();
      lineMesh.geometry = new THREE.BufferGeometry().setFromPoints(points);  
  }
   
}
setInterval(()=>{
  changeLine(mesh);
},1000)

function render(){
  
  renderer.render(scene, camera);
  requestAnimationFrame(render);
  keyControls(keysPressed);
}

render();